Since none of the items in your <html:options> collection is (or can be) null [*], 
even if the user does not make a selection, there is a default value and therefore the 
validation is successful.  

You could try to add a dummy default value (such as "Please select one") and use a 
NOTEQUAL test.

Sri

* You may run into a problem with setting a null option value.  See 
http://marc.theaimsgroup.com/?l=struts-user&m=104438878004590&w=2

-----Original Message-----
From: Suresh Addagalla [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, February 05, 2003 9:27 AM
To: 'Struts Users Mailing List'
Subject: html:select validation


Hi,

I have an html:select with multiple option as follows.

<html:select multiple="true" size="3" property="serviceSetOfService">
  <html:options collection="serviceSets" property="code" labelProperty="name"/> 
</html:select>

My validator fails to validate the above one for "required". If I leave the selection 
box without selecting and submit the form, Validator doesn't complain. Pls let me know 
if anyone has a clue why this is happening.

My validation.xml has:

            <field property="serviceSetOfService"
                depends="required">
                    <arg0 key="text.services.serviceset"/>
             </field>

Thanks,
Suresh


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to