Solved

Restrict Access to Form Submit Button using CF?

Posted on 2004-03-26
5
222 Views
Last Modified: 2013-12-24
hello.
I need to activate (show or hide?) a FORM's submit button IF a condition exsists or does not exist (someone voting on a sample poll already ... means HIDE the submit button so they cannot vote again).

Any ideas how / if / I can do this using CF!? else!?

Thanks much!
Richard
0
Comment
Question by:rcbuchanan
  • 2
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
M256 earned 300 total points
ID: 10692277
If you want to do it on the Client side, you need JavaScript.

Otherwise, you could use the following ColdFusion code:

<cfparam name="session.voted" default="false">
<form>
<input type="text"><br>
<cfif session.voted is false>
<input type="submit">
</cfif>
</form>

Put this line on the action page of the form:
<cfset session.voted = true>

Matthew
0
 
LVL 9

Assisted Solution

by:CFDevHead
CFDevHead earned 200 total points
ID: 10692306
<cfparam name="cookie.vote" default="">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Vote Now</title>
</head>

<body>
      <form name="frmMain" action="index.cfm" method="post"<cfif cookie.vote is ""> onSubmit="return false;"</cfif>>
      
      <cfif cookie.vote is "">
      <input type="submit" value="vote">      
      </cfif>
      </form>
</body>
</html>
0
 
LVL 9

Expert Comment

by:CFDevHead
ID: 10692313
Similar to M256
0
 

Author Comment

by:rcbuchanan
ID: 10692431
Thanks guys!
Is perfect.
0
 
LVL 5

Expert Comment

by:M256
ID: 10692448
rcbuchanan,

Glad to help.

Matthew
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
What You Need to Know when Searching for a Webhost Provider

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question