I need help for validating check box in struts validation without using javascript.
when I click the submit button atleast one check box should be selected. Can anyone help me how to define in validation XML,
how to do it with requiredif and validatewhen conditions, in my jsp page we have 10 checkboxes.
Please let me know if you have any solution for this. it should be server side validation
Did you know we have a forum just for Struts questions? I'll move this for you. The forum software will magically link this post to the move so you can just click it.
You can do this by making the property name for each checkbox the same or by using the html:multibox tag. Then you can simply use the "required" validation to verify that at least one checkbox was checked.
Its very urgent, can you help me for checkbox validation. I my JSP I cannot change the checkbox property names ,because all properties are having with different names, any suggestions.
Either use validwhen and construct the expression so at least once checkbox is required (or whatever your requirement is) or do it on the Java side in a validate() method.
Searching the web should provide *numerous* examples; it's a simple matter of checking the form properties in question and adding an error if the proper conditions aren't met. IIRC this can be combined with XML validation by calling super.validate() as well.
Check your pockets for water buffalo. You might need to use this tiny ad until locate a water buffalo:
Gift giving made easy with the permaculture playing cards