You would need to validate the form items against the session variables.
Thus if the form variable does not exists or set to false, kill the
Session variable.

All should be done on the Save (submit) event. 

-----Original Message-----
From: Jeremy Bunton [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 20, 2006 11:45 AM
To: CF-Talk
Subject: How do you all handle saving checkboxes that have been checked?

I have several forms that have check boxes. I set the vales of the
checkboxes to sessions after the form is submitted so that a user can surf
around the site and come back and change their selections. The code I use is
below and it sort of works - but not really. Its checks to see if the value
is in the session and checks the box if it is. The problem is if someone
unchecks all the boxes and hits submit. Though the box was unchecked by the
user the code below says it was and hence one value always gets posted back
to the session and it resets itself and checks a box.  

<cfif #trim(session.fstate)# contains #trim(stateabbr)#> <input
type="Checkbox" name="fstate" value="'#trim(stateabbr)#'"
checked>#state#<br>
<cfelse>
<input type="Checkbox" name="fstate" value="'#trim(stateabbr)#'">#state#<br>
</cfif>
</cfoutput>






~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:235772
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to