It seems that you can mark a CheckBoxList as mandatory, but the user can submit the form without checking any options. I'd like to force them to check at least one option. Any thoughts on how to achieve this?
I see in the Shared Source the CheckBoxList inherits from a custom control called ValidateableCheckBoxList, so I would think this was already thought of, but doesn't seem to be working
Upon further investigation, the mandatory option does work, but not right away.
For example, if you have a textbox and a checkboxlist, both marked as mandatory, and click Submit, the form reports the Textbox is mandatory, highlights it in red, etc - but ignores the checkboxlist.
If you then fill out the textbox and click submit, then the checkboxlist is validated.
Is there some type of client side validation going on first maybe, that doesnt support the checkboxlist?
It does look like there is some client side validation happening first, which does not include the checkboxlist (confirmed with Fiddler).
Any easy way to make the client side validation support checkboxlists, or maybe even disable the client side validation for a given form? Client is complaining - have a rather lengthy form that has a checkboxlist getting validated separately from the other fields.
Make a CheckBoxList Mandatory
Hi,
It seems that you can mark a CheckBoxList as mandatory, but the user can submit the form without checking any options. I'd like to force them to check at least one option. Any thoughts on how to achieve this?
I see in the Shared Source the CheckBoxList inherits from a custom control called ValidateableCheckBoxList, so I would think this was already thought of, but doesn't seem to be working
Any ideas?
Thanks,
Tom
Upon further investigation, the mandatory option does work, but not right away.
For example, if you have a textbox and a checkboxlist, both marked as mandatory, and click Submit, the form reports the Textbox is mandatory, highlights it in red, etc - but ignores the checkboxlist.
If you then fill out the textbox and click submit, then the checkboxlist is validated.
Is there some type of client side validation going on first maybe, that doesnt support the checkboxlist?
It does look like there is some client side validation happening first, which does not include the checkboxlist (confirmed with Fiddler).
Any easy way to make the client side validation support checkboxlists, or maybe even disable the client side validation for a given form? Client is complaining - have a rather lengthy form that has a checkboxlist getting validated separately from the other fields.
Thanks,
Tom
Bump...any ideas on fixing or working around by maybe disabling the client side validation?
is working on a reply...