Steve, to respond to your inquiry specifically, I've always felt it was best to
take complete control over what is in the Form scope, right from the top, by
laying out a series of <cfparam> tags and their default values, especially if
check boxes or initially-unselected radio button groups are part of the form.
<cfparam name="Form.thisField" default="">
<cfparam name="Form.thatField" default="0">
Then my back-end logic, working with the assumption that everything IS defined,
regardless of what the user did or did not do in the form, is free to simply
test a form field value to see if it has changed from its default to know if it
has been selected or a user value provided. No dinking around with browser
implementation junk.
With that Yes/No radio button thing, general UI guidelines specify that at
least one element of a mutually exclusive control group be defaulted to
'selected' when the interface is presented. After having said that, though, you
should actually consider changing question input like "Do you have an
Undergraduate Degree?" from a Yes/No (boolean) radio button input to simply a
single check box, with a rephrased question like "I have an Undergraduate
Degree". Then, that's where your use of the <cfparam> tag comes into play,
because you can prescribe a fixed value to that one check box input element,
and only when the check box is checked off does that become the value for it,
differentiating it from the default value, and indicating that it was
"selected".
<cfparam name="Form.UnderGrad" default="0">
...
<input type="checkbox" name="UnderGrad" value="1"> <strong>I have an
Undergraduate Degree</strong>
...
<cfif Form.UnderGrad eq 1>
<!--- If it equals 1 at form submit, instead of the default 0, then it was
selected --->
</cfif>
-Christopher
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350904
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm