You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Mike Zatko <mz...@boscovs.com> on 2004/04/23 20:23:48 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: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org