You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Priya Jotwani <Pr...@infosys.com> on 2004/10/06 14:22:04 UTC

Listbox Validation in struts

Hi,

 

I have a JSP Page where I have a multiple selection Listbox. When the
user submits the page, there should be some values in this listbox. How
do I make the validations for the same in validator.xml ? 

I have done similar thing for dropdown by the following entry in
validator.xml

 

<field property="reportType" depends="required ">

            <arg0 key="prompt.reportType"/>

</field>

 

How can I achieve the similar thing for Multi Select ListBox ?

 

TIA,

Priya


Re: Listbox Validation in struts

Posted by Bill Siggelkow <bi...@bellsouth.net>.
If you want to ensure that at least one item is selected from the 
mulit-select list you can use "required" just like with the drop-down. 
If you need something more (like at least 2 items selected), to use 
Validator you will need to create a custom rule.

-Bill Siggelkow

Priya Jotwani wrote:

> Hi,
> 
>  
> 
> I have a JSP Page where I have a multiple selection Listbox. When the
> user submits the page, there should be some values in this listbox. How
> do I make the validations for the same in validator.xml ? 
> 
> I have done similar thing for dropdown by the following entry in
> validator.xml
> 
>  
> 
> <field property="reportType" depends="required ">
> 
>             <arg0 key="prompt.reportType"/>
> 
> </field>
> 
>  
> 
> How can I achieve the similar thing for Multi Select ListBox ?
> 
>  
> 
> TIA,
> 
> Priya
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org