...

View Full Version : FORM.FieldNames Checkboxes



tom123
01-18-2008, 10:57 AM
Hey

Im trying to retreive the value of a checkbox in my script i.e. checked/unchecked.
Problem is if i uncheck the box on the form and submit it, the checkbox is not picked up in the form variables.
Any Ideas?


<td><input type="checkbox" name="CONTACTED" value="#getClientTransactions.paymentAttemptID#" <cfif getClientTransactions.Contacted eq 1>checked="true"</cfif> ></td>

shyam
01-22-2008, 07:05 PM
Im trying to retreive the value of a checkbox in my script i.e. checked/unchecked.
Problem is if i uncheck the box on the form and submit it, the checkbox is not picked up in the form variables.

thats how checkboxes work...if they are unchecked they are not sent as part of the form post...if u want the value irrespective of whether the checkbox is checked or not then use hidden fields

Shift4Sms
02-08-2008, 06:31 PM
thats how checkboxes work...then use hidden fields
A simplier approach is to use the CFPARAM tag:

<cfparam name="FORM.Contacted" default="unchecked">

ryanaghdam
06-24-2008, 04:46 PM
You can also check to see if is defined in the page that parses it.

e.g.



<cfif IsDefined(FORM.checkbox)>
...
<cfelse>
...
</cfif>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum