On 10/31/05, Ashish Kulkarni <[EMAIL PROTECTED]> wrote:
> Hi
> I want to validate 1 field from jsp, if other field
> value is '3'.
> so i added the following validation in validation.xml
> <form name="POApprovalForm">
>  <field property="comment" depends="validwhen">
>  <arg0 key="errors.comment" />
>        <var>
>         <var-name>ttype</var-name>
>         <var-value>2</var-value>
>        </var>
>  </field>
> </form>
> but it seems it is not working,

The "validwhen" validator requires a "test" <var> which specifies the
condition. Try something like the following

 <var>
      <var-name>test</var-name>
      <var-value>((ttype != 3) or (*this* != null))</var-value>
 </var>

Take a look at the Validator User Guide:

   
http://struts.apache.org/struts-doc-1.2.7/userGuide/dev_validator.html#validwhen

Also Struts 1.2.7 includes a page of examples of the "validwhen"
validator in the "struts-examples" webapp which is shipped with the
binary distribution - follow the "Validator Examples" link and you
should see a link to the "validwhen Example Form".

Niall

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

Reply via email to