This works fine for me with multi-select.

For single select, you can force it to work by making the first option
return an empty String:

  <html:select property="myprop">
                <html:option value="">Please select a value --&gt</html:option>
                <html:option value="option1">Option 1</html:option>
                <html:option value="option2">Option 2</html:option>
                <html:option value="option3">Option 3</html:option>
  </html:select>

Don't forget you can combine multiple option(s) tags:

   <html:select property="roles" multiple="true" size="5">
     <html:option value="">Please select a value --&gt</html:option>
     <html:options collection="<%=my.Const.ROLE_TYPES%>"
property="roleName" />
   </html:select>

HTH

Steve

-----Original Message-----
From: Bailey, Shane C. [mailto:[EMAIL PROTECTED]
Sent: June 12, 2003 11:33 AM
To: [EMAIL PROTECTED]
Subject: Does "required" work with Multi Select




The following code doesn't seem to validate whether the user chose an item.
In other words if a user doesn't select anything it still passes validation:

JSP:
   <html:select property="roles" multiple="true" size="5">
     <html:options collection="<%=my.Const.ROLE_TYPES%>"
property="roleName" />
   </html:select>

validation.xml:
    <field property="roles" depends="required">
      <arg0 name="required" key="label.user.Roles" />
    </field>


All the other fields validate just fine.


Should I assume select (since it will return a value no matter what for a
single select)

isn't supported as an element type which can be "required" ???






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

Reply via email to