Check out the "requiredif" validator, you can use it with the NULL
condition to require one field if the other one is null.

James

> -----Original Message-----
> From: Steve [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, March 19, 2003 9:27 AM
> To: [EMAIL PROTECTED]
> Subject: 1.1-rc1 and Validator
> 
> 
> I have just recently begun to utilize the validator in our 
> application and had I simple question that I could not find 
> an answer to searching the archives. I have a search form 
> that a user can enter in 1..n criteria for searching. In a 
> simple case there are two input fields. The validation should 
> ensure that at least one of the fields are populated prior to 
> submitting the form. How would I configure my validation.xml 
> for this case? I currently have the following:
> 
>  <form name="TestSearchForm">
>       <field
>               property="someCriteria"
>             depends="required,minlength">
>             <msg name="required" key="errors.required"/>
>             <arg0 key="searchForm.someCriteria"/>
>             <arg1 name="minlength" key="${var:minlength}" 
> resource="false"/>
> 
>             <var>
>                 <var-name>minlength</var-name>
>               <var-value>5</var-value>
>             </var>
>       </field>
>       <field property="otherCriteria"
>                     depends="required">
>               <msg name="required" key="errors.required"/>
>             <arg0 key="searchForm.otherCriteria"/>
>       </field>
>  </form>
> 
> Which works exactly as you would expect requiring that both 
> fields are populated. Thanks.
> 
> 
> ---------------------------------------------------------------------
> 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]

Reply via email to