We are using commons validation from spring modules and works great for text fields. But, when we use it for checkboxes, it doesn't seem to work.
In the validation.xml, we have the following entry
<field property="agreedLegalPolicy" depends="required">
<msg name="required" key="error.legalnotchecked" />
</field>
In our command object the agreedLegalPolicy is a boolean field.
Tracing the code using a debugger, it looks like the required check always succeed since the boolean is initialized to false when the checkbox is not checked.
Any thoughts on how this should work will be appreciated. The alternative I am considering is to use a custom validation class or override the onBindAndValidate of the form controller to perform custom validation.
Thanks.


Reply With Quote