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

SiobhanElara
SiobhanElara used Ask the Experts™
on
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!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2015

Commented:
Really... that just sounds like a bug to me.  Because it works perfectly when the checkboxes are uniquely named.
Most Valuable Expert 2015
Commented:
Sorry to say the cfform stuff seems to be handled somewhere deep in the bowels of CF. So I don't know if it's possible for developers to fix the issue.  So I think you'll have to handle it in code yourself for now.  But do submit a bug report in the Adobe bug db so this can be fixed..

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial