I use a UDF for doing this.

E.g

<cfscript>
Function setChecked(val1,val2)
{
If(val1 eq val2) return "checked";
Else return "";
}
Function setSelected(val1,val2)
{
If(val1 eq val2) return "selected";
Else return "";
}
</cfcript>

<!--- I generally don't scope so that I can accept either urL or FORM
variables to a page, I only scope if it will cause ambiguity --->
<cfparam name="sex" default="male">
<cfparam name="country" default="UK">

<input name="sex" type="checkbox" value="male" #setchecked(sex,'male')#>

<select name="country">
<cfoutput query="country">
<option value="#countrycode#" setSelected(country,'#countrycode#')>
</cfoutput>
</select

--
snake

-----Original Message-----
From: Bobby Hartsfield [mailto:[EMAIL PROTECTED] 
Sent: 02 September 2005 01:32
To: CF-Talk
Subject: RE: retaining checkbox selections

Yes

<cfparam name="form.checkone" default="1"> <cfparam name="form.checktwo"
default="0">

<form name="myform" action="index.cfm" method="post">

<input type="checkbox" name="checkone" value="1"<cfif val(form.checkone)>
checked><br>

<input type="checkbox" name="checktwo" value="1"<cfif val(form.checktwo)>
checked><br>

<input type="submit" name="submit">
</form>

Unchecked checkboxes do not exist in the form scope. The cfparams make sure
they are there at all times.


-----Original Message-----
From: Tim Laureska [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 01, 2005 3:10 PM
To: CF-Talk
Subject: RE: retaining checkbox selections

Like <cfparam name="whatever" default=""> ?

-----Original Message-----
From: Bobby Hartsfield [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 01, 2005 1:43 PM
To: CF-Talk
Subject: RE: retaining checkbox selections

Or just use cfparams for all the form fields at the top of each stepped page

-----Original Message-----
From: Ian Skinner [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 01, 2005 1:23 PM
To: CF-Talk
Subject: RE: retaining checkbox selections

What I would suggest is to create a form object/structure mirror in a
persistent scope that has name/value pairs for the entire form.
Initialize
this data entity with empty values at the beginning of the process.
Then
always populate form fields from this data.  At the beginning it will be
null/empty values, but as the form is completed it will contain the values
of the user.  Then no matter what the user does, the form will have
appropriate data.




--------------
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA
 
"C code. C code run. Run code run. Please!"
- Cynthia Dunning

Confidentiality Notice:  This message including any attachments is for the
sole use of the intended
recipient(s) and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited. If you
are not the intended recipient, please contact the sender and delete any
copies of this message. 












~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:217179
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to