You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "contest.vix" <co...@bol.com.br> on 2006/08/24 14:31:46 UTC

Validating Collections in Struts

Hi,
Please, could somebody help me?
Does anyone knows how can I validate a collection with Validator?
My Form is declared as de folowing:
----begin form class
EmailForm extends ValidatorForm{
       /** selected responsables' email. */
    private String [] selectedEmails = null;

    /** List of the responsables' email. */
    private List emails = new ArrayList();
}
----end form class
In the Jsp I have:
----begin jsp
<html:select styleClass="textoTextfield" multiple="multiple"
  property="selectedEmails">
    <html:optionsCollection property="emails"					    label="label" value="value" />
</html:select>
----end jsp

I have to validate each email included in the List (emails) and its required. Does anyone knows how to setup validator for validating this?
I´ve tried the folowing with no success:
-----begin validator file
<field property="selectedEmails" depends="required">
        <arg0 key="Email" resource="false"/>
        <msg name="required" key="errors.required"/>
</field>
-----end validator file

Thanks a lot,
Roger



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