You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Christopher Becker <CB...@cablevision.com> on 2006/02/07 17:29:35 UTC

validating mutiple html:checkbox values

I have a form in a Struts 1.2.7 app that displays a dynamic list of
html:checkbox fields, all having the same property value
(property=choseRole), which I present using a c:forEach tag.  I wish to
apply validation to this set of checkboxes, and I am currently using the
Validator plugin on all forms in the app. I have a formbean that extends
the ValidatorForm for this particular form.
 
I have two questions:
1) How do I represent choseRole as a field in the formbean?  and
2) How do I get the validator to see this multivalued property?
 
I need some kind of dynamic value, as the list of checkboxes can change
in size. I have tried ArrayList, Vector, etc. without success. I also
tried using multibox instead of checkbox.
 
I can get the validator to work by using a String value (just to test
the 'required' validation) but if more than one checkbox is selected,
only one returns if other fields of the form fail the validation test.
 
Any guidance or insight would be appreciated... thanks!

Regards,
 
--Chris
 
 
 
Chris Becker
Senior Programmer/Analyst
Enterprise IT
(516) 803-3921
cbecker@cablevision.com