« Return to Thread: How to validate a checkboxlist?

How to validate a checkboxlist?

by mojoRising :: Rate this Message:

Reply to Author | View in Thread

I am trying to perform client side validation on a struts checkboxlist tag but nothing I try seems to work.  ANy ideas? I do not want to submit the form and do a validation method in the action bean because obviously it would be ridiculous to post back to the server just to check that there is at least one checkbox selected....

This is what I have:  


<s:checkboxlist  label="Assigned Roles"  title="Assigned Roles"
                         name="selectedRoles"
                         value="selectedRoles"
                         listValue="value"
                         listKey="id"
                         list="roleList"
                         required="true"/>


<!DOCTYPE validators PUBLIC
        "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
        "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">

<validators>
        <field name="selectedRoles">
        <field-validator type="required">
              <message>You must select at least one role for this user</message>
        </field-validator>
    </field>
</validators>

 « Return to Thread: How to validate a checkboxlist?