Hi Mallik,
Use a collection of String instead of an array of String. And in the
validation.xml file add the "indexedListProperty" field such like this :
struts-config.xml:
<form-bean name="empForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="departments" type="java.util.Collection" />
<form-property name="city" type="java.lang.String" />
</form-bean>
validation.xml:
<form name="empForm">
<field property="departments" depends="required"
indexedListProperty="java.lang.String">
<arg0 key="departments.req"/>
</field>
<field property="city" depends="required">
<arg0 key="city.req"/>
</field>
</form>
Charles Gouin-Vallerand
-----Original Message-----
From: m Komma [mailto:[EMAIL PROTECTED]
Sent: May 12, 2005 5:48 PM
To: [EMAIL PROTECTED]
Cc: Struts Users Mailing List
Subject: Re: how to validate when the form-property is of
type="java.lang.String[]"
My problem is not accessing the values but is with validator.
I have the validation working correctly if within the
struts-config.xml file the form-property type="java.lang.String"
My issue is that I can't validate when the form-property is of
type="java.lang.String[]" (I can't validate the form-property
departments in the example listed below). Do I need to include
something in the validation.xml that indicates I am working with
type="java.lang.String[]"
struts-config.xml:
<form-bean name="empForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="departments" type="java.lang.String[]" />
<form-property name="city" type="java.lang.String" />
</form-bean>
validation.xml:
<form name="empForm">
<field property="departments" depends="required">
<arg0 key="departments.req"/>
</field>
<field property="city" depends="required">
<arg0 key="city.req"/>
</field>
</form>
Again, I have the validation working correctly when form-property is
of type="java.lang.String". I can't however validate when the
form-property is of type="java.lang.String[]".
Mallik
On 5/12/05, David Johnson <[EMAIL PROTECTED]> wrote:
> What exactly is the problem you're having? Normally I'd say you'd loop
> through the array of values passed in thru the form bean
>
>
> On 5/12/05, m Komma < [EMAIL PROTECTED]> wrote:
> >
> > Hi,
> > I have a problem using validatorplugin for multiselection box.
> > my filed is of type <form-property name="departments"
> > type="java.lang.String[]" />
> >
> > I can't validate when the form-property is of type="java.lang.String[]"
> >
> > I have the validation working correctly when form-property is of
> > type="java.lang.String". I can't however validate when the
> > form-property is of type="java.lang.String[]".
> >
> > any help is appreciated.
> >
> > Thanks,
> > Mallik
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
>
> --
> -Dave
> [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]