You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by James Turner <tu...@blackbear.com> on 2002/10/30 01:03:36 UTC
Re: struts-user Digest 29 Oct 2002 23:31:46 -0000 Issue 2195
At 06:31 PM 10/29/2002, Roy.Stephan@hydro.qc.ca wrote:
>Nested form validation
>
>I would like to know
>
>1) Did anyone succeeded in validating nested form?
>2) Do you have a validation.xml example?
>
>I have a form <a>, one simple property <b> but another property is a form
><c> with a property <d>.
>
>Everything works fine except for the validations. I tried the following:
><form name="a">
> <field property="b" depends="required,maxlength">..</field>
> <field property="c.d" depends="required,mask">..</field>
></form>
>
>Thank you
Here you go:
<form name="dependentlistForm">
<field property="firstName" indexedListProperty="dependents"
depends="required">
<arg0 key="dependentlistForm.firstName.label"/>
</field>
<field property="dob" indexedListProperty="dependents"
depends="required,date">
</field>
<field property="gender" indexedListProperty="dependents"
depends="required">
</field>
<field property="relationship" indexedListProperty="dependents"
depends="required">
</field>
</form>
Where dependentlistForm is defined in struts-config.xml as:
<form-bean name="dependentlistForm"
type="com.benefit.association.struts.forms.ValidatorForm">
<form-property name="dependents"
type="com.benefit.association.Dependent[]"
initial="{'','','','','','','','','','',''}"/>
</form-bean>
And Dependent is defined as a normal bean with firstName, lastName, dob,
gender and relationship as properties.
James
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>