To check if the radio button is checked or not, use the followin':
<cfif isDefined("SelectAddress">
In case the radio button is not checked, this statement will return 0 (false), otherwise it will return 1 (true).
To check the value of the radio button, use the followin': <cfif #SelectAddress# is "1">
<cfif #SelectAddress# is "2"> .. etc ..
I hope this will help you.
<CFBikzit Text="Hi There">
Your CFIF syntax is fine, but you should always receive some value for #selectAddress#. If not, make sure you default one of the options on your form page to checked--whatever the value.
dear strantheman,
sometimes you have to leave the radio buttons unchecked. for example if you have two radio-buttons, one has the value 'Male' and the other has the value 'Female', then it's not a good idea to make one of these buttons checked by default, cos the user might forget to select his/her gender, and then the form will accept the value of the radio-button cos it's checked by default .. when you leave these buttons unchecked, you have the chance to remind the user to select his/her gender. i hope you got it <CFBikzit Text="Hi There">
Yes correct. But khurram's question is about the action page, and he's trying to reference a variable that isnt there. Im just saying the variable should always be passed, whether you wait for the user to check it, or force one checked by default.
If he has asked how to validate his form it would be a different issue. But yea I know what you mean, there's some questions that must be answered.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.