Link to home
Start Free TrialLog in
Avatar of SiobhanElara
SiobhanElaraFlag for United States of America

asked on

All checkboxes in a group checking after using cfform's preservedata

I have a page that contains a form and I'm using cfform's preservedata attribute. It  works like a charm for text fields and radio buttons, but I'm having a problem with checkboxes.

If no items in a group are selected, no items are selected when the page reloads. If any items are selected, ALL items in the group are selected when the page reloads. A Google search turned up a few people asking about this same issue but there weren't any real answers.

The official documentation states, "ColdFusion MX: Changed the cfform tag preserveData attribute behavior: if it is set to True, ColdFusion checks radio and check box values only if their value matches the posted value for the control. (In earlier releases, if the posted value did not match any of the cfinput check boxes or radio buttons for the control, the checked attribute was used.)" It seems that's the way it USED to behave, but we're using CF8.

Any idea what I might be doing wrong? Here's the code for my quick-and-ugly form:

<cfform action="" preservedata="yes">
<cfinput name="texty" type="text" id="texty" /><br />
<cfinput type="radio" name="1" id="radio" value="yes" />Yes <cfinput type="radio" name="1" id="radio" value="no" />No<br />
<cfinput name="thisisacheckbox" type="checkbox" value="indeed" />Indeed <cfinput name="thisisacheckbox" type="checkbox" value="of course" />Of Course <cfinput name="thisisacheckbox" type="checkbox" value="obviously" />Obviously<br />
<cfinput name="submit" type="submit" />
</cfform>

Thanks!
Avatar of _agx_
_agx_
Flag of United States of America image

Really... that just sounds like a bug to me.  Because it works perfectly when the checkboxes are uniquely named.
ASKER CERTIFIED SOLUTION
Avatar of _agx_
_agx_
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial