Avatar of hai_madhan
hai_madhan

asked on 

Struts 2 : validating select box with validator xml

Hi,

I've defined the validation for my form fields in the validation.xml (I'm using struts 2).
I'm having trouble validating a multiple select box. I want to do a required field validation for the select box.
Here is the validation definition for the select box in the validation.xml:

<field name="clientMNA.businesses.id">
        <field-validator type="required">
            <message key="business.required"/>
        </field-validator>
</field>

where "clientMNA.businesses.id" is the select box name.  When I submit with out selecting any values the page displays the " field required " message properly as expected. But even when I select one or more values in the select box, the validation fails and shows the " field required " message.

How to resolve this?

Thanks,
Madhan
 
Java EEJSP

Avatar of undefined
Last Comment
Keios_Titan

8/22/2022 - Mon