If you use the field-indexed parameter of required-if, the
dependent-field will get the same index as the dependee field, for
example:

    <field property="firstName" indexedListProperty="dependents"
depends="requiredif">
      <arg0 key="dependentlistForm.firstName.label"/>
      <var>
        <var-name>field[0]</var-name>
        <var-value>lastName</var-value>
      </var>
       <var>
        <var-name>field-indexed[0]</var-name>
        <var-value>true</var-value>
      </var>
      <var>
        <var-name>field-test[0]</var-name>
        <var-value>NOTNULL</var-value>
      </var>
     </field>

This says:  The firstName field is required if the lastName field is not
null, for each indexed value of dependents.  So if
dependents[3].firstName is being checked, it will be checked against
dependents[3].lastName

James


> -----Original Message-----
> From: Bhamani, Nizar A TL56E [mailto:[EMAIL PROTECTED]] 
> Sent: Wednesday, December 11, 2002 5:34 PM
> To: 'Struts Users Mailing List'
> Subject: RE: Dynamic list validations
> 
> 
> Thanks for your response. I am already using this 
> (requiredIf) with hardcoded field iterator index values i.e. 
> ' field0', 'field_value0', ...
> 
> I wanted to know if we can do this without hardcoding the indexes.
> 
> Nizar.
> 
> -----Original Message-----
> From: James Turner [mailto:[EMAIL PROTECTED]] 
> Sent: Wednesday, December 11, 2002 5:10 PM
> To: 'Struts Users Mailing List'
> Cc: [EMAIL PROTECTED]
> Subject: RE: Dynamic list validations
> 
> Look at the new RequiredIf validation in the night build, it 
> supports just this mechanism.
> 
> James
> 
> > -----Original Message-----
> > From: Bhamani, Nizar A TL56E [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, December 11, 2002 5:07 PM
> > To: 'Struts Users Mailing List'
> > Subject: Dynamic list validations
> > 
> > 
> > Our forms have a list of input fields and we are using
> > struts-validators to Validate our forms. i.e. the form looks like :
> > 
> > InputField1[0]      InputField2[0]
> > InputField1[1]      InputField2[1]
> > InputField1[2]      InputField2[2] 
> > InputField1[3]      InputField2[3]
> > ....
> > 
> > I want to perform validations in such a way that
> > If InputField1[0] is entered then InputField2[0] is required. 
> > If InputField2[1] is entered then InputField1[1] is required.
> > 
> > And so on...
> > 
> > Has anyone performed such validations ?
> > 
> > Nizar. ____________________________________________________________
> > CONFIDENTIALITY
> > This e-mail and any attachments are confidential and also may
> > be privileged. If you are not the named recipient, or have 
> > otherwise received this 
> > communication in error, please delete it from your inbox, 
> > notify the sender immediately, and do not disclose its 
> > contents to any other person, 
> > use them for any purpose, or store or copy them in any medium. 
> > Thank you for your cooperation. 
> > ____________________________________________________________
> > 
> > 
> > 
> > --
> > To unsubscribe, e-mail:   
> > <mailto:struts-user-> [EMAIL PROTECTED]>
> > For
> > additional commands, 
> > e-mail: <mailto:[EMAIL PROTECTED]>
> > 
> 
> ____________________________________________________________
> CONFIDENTIALITY
> This e-mail and any attachments are confidential and also may 
> be privileged.
> If you are not the named recipient, or have otherwise received this 
> communication in error, please delete it from your inbox, 
> notify the sender
> immediately, and do not disclose its contents to any other person, 
> use them for any purpose, or store or copy them in any medium. 
> Thank you for your cooperation. 
> ____________________________________________________________
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:struts-user-> [EMAIL PROTECTED]>
> For 
> additional commands, 
> e-mail: <mailto:[EMAIL PROTECTED]>
> 



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to