You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mike Zatko <za...@comcast.net> on 2004/04/24 00:08:23 UTC
Validator with DynaValidatorForm
Hello,
I have a DynaValidatorForm called EditProfileForm defined with a Form
Property of "emails". The type for the property is EmailAddress[] and
has no size property which means I generate it dynamically. The
EmailAddress bean has a property of "address", denoting the actual value
of the email adress. Now, in the JSP I have a textbox for each
EmailAddress.
> <c:forEach var="emails"
> items="${EditProfileForm.map.emails}">
> <tr>
> <td width="240"><html:text
> style="width: 200px;" name="emails" indexed="true"
> property="address"/></td>
> </tr>
> </c:forEach>
The source for the generated HTML is as follows:
<td width="240"><input type="text" name="emails[1].address"
value="mzatko@boscovs.com" style="width: 200px;"></td>
In my validation.xml, I have the following for this property:
<field property="emails"
depends="maxlength">
<arg0 key="editProfile.form.emails.invalid"/>
<arg1 name="maxlength" key="${var:maxlength}"
resource="false"/>
<var>
<var-name>maxlength</var-name>
<var-value>50</var-value>
</var>
</field>
The validator is not working on my dynamic fields. I do have other
properties on this same page that are validated fine, just not this
dynamic one.
Anybody have any ideas how to get it working?
Thanks.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Validator with DynaValidatorForm
Posted by Mike Zatko <mz...@boscovs.com>.
Thank you. It worked.
Niall Pemberton wrote:
>Try
>
> <field property="address" indexedListproperty="emails"
> depends="maxlength">
>
>Niall
>
>----- Original Message -----
>From: "Mike Zatko" <za...@comcast.net>
>To: <us...@struts.apache.org>
>Sent: Friday, April 23, 2004 11:08 PM
>Subject: Validator with DynaValidatorForm
>
>
>
>
>>Hello,
>> I have a DynaValidatorForm called EditProfileForm defined with a Form
>>Property of "emails". The type for the property is EmailAddress[] and
>>has no size property which means I generate it dynamically. The
>>EmailAddress bean has a property of "address", denoting the actual value
>>of the email adress. Now, in the JSP I have a textbox for each
>>EmailAddress.
>>
>>
>>
>>> <c:forEach var="emails"
>>>items="${EditProfileForm.map.emails}">
>>> <tr>
>>> <td width="240"><html:text
>>>style="width: 200px;" name="emails" indexed="true"
>>>property="address"/></td>
>>> </tr>
>>> </c:forEach>
>>>
>>>
>>
>>The source for the generated HTML is as follows:
>>
>><td width="240"><input type="text" name="emails[1].address"
>>value="mzatko@boscovs.com" style="width: 200px;"></td>
>>
>>
>>In my validation.xml, I have the following for this property:
>>
>> <field property="emails"
>> depends="maxlength">
>> <arg0 key="editProfile.form.emails.invalid"/>
>> <arg1 name="maxlength" key="${var:maxlength}"
>>resource="false"/>
>> <var>
>> <var-name>maxlength</var-name>
>> <var-value>50</var-value>
>> </var>
>> </field>
>>
>>The validator is not working on my dynamic fields. I do have other
>>properties on this same page that are validated fine, just not this
>>dynamic one.
>>Anybody have any ideas how to get it working?
>>
>>Thanks.
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>>
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
--
Michael H. Zatko
WebSphere Developer
Boscov's Information Services
Work: 610-929-7317
Home: 610-562-2407
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Validator with DynaValidatorForm
Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
Try
<field property="address" indexedListproperty="emails"
depends="maxlength">
Niall
----- Original Message -----
From: "Mike Zatko" <za...@comcast.net>
To: <us...@struts.apache.org>
Sent: Friday, April 23, 2004 11:08 PM
Subject: Validator with DynaValidatorForm
> Hello,
> I have a DynaValidatorForm called EditProfileForm defined with a Form
> Property of "emails". The type for the property is EmailAddress[] and
> has no size property which means I generate it dynamically. The
> EmailAddress bean has a property of "address", denoting the actual value
> of the email adress. Now, in the JSP I have a textbox for each
> EmailAddress.
>
> > <c:forEach var="emails"
> > items="${EditProfileForm.map.emails}">
> > <tr>
> > <td width="240"><html:text
> > style="width: 200px;" name="emails" indexed="true"
> > property="address"/></td>
> > </tr>
> > </c:forEach>
>
>
>
> The source for the generated HTML is as follows:
>
> <td width="240"><input type="text" name="emails[1].address"
> value="mzatko@boscovs.com" style="width: 200px;"></td>
>
>
> In my validation.xml, I have the following for this property:
>
> <field property="emails"
> depends="maxlength">
> <arg0 key="editProfile.form.emails.invalid"/>
> <arg1 name="maxlength" key="${var:maxlength}"
> resource="false"/>
> <var>
> <var-name>maxlength</var-name>
> <var-value>50</var-value>
> </var>
> </field>
>
> The validator is not working on my dynamic fields. I do have other
> properties on this same page that are validated fine, just not this
> dynamic one.
> Anybody have any ideas how to get it working?
>
> Thanks.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org