Are you sure your destinationName validation is correct - seems to me like
it should always give a validation error if buttonSelected is not "find"? I
think it should be something like the following....


> destinationName is required only when destinationReference is null AND
> the parameter 'buttonSelected' is 'find'

<field property="destinationName" depends="validwhen">
    <arg0 key="prompt.destinationName"/>
        <var>
             <var-name>test</var-name>
                 <var-value>(*this* != null) or
                                      ( (buttonSelected != "find") or
(destinationRef != null))
                 </var-value>
        </var>
 </field>


For the destinationReference validation, how about the following...

> destinationReference is ALWAYS required EXCEPT when 'buttonSelected' is
> 'find' and destinationReference is not null

<field property="destinationRef" depends="validwhen">
    <arg0 key="prompt.destinationRef"/>
        <var>
             <var-name>test</var-name>
                 <var-value>(*this* != null) or
                                      ((buttonSelected == "find") and
(destinationName != null))
                </var-value>
        </var>
 </field>

Niall

----- Original Message ----- 
From: "Marco Mistroni" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Thursday, September 16, 2004 12:13 PM
Subject: Validator question


> Hi all,
> I have following issue with Validator
>
> I have a form that has, between other fields, two fields,
> destinationReference and destinationName.
>
> destinationName is required only when destinationReference is null AND
> the parameter 'buttonSelected' is 'find'
>
> destinationReference is ALWAYS required EXCEPT when 'buttonSelected' is
> 'find' and destinationReference is not null
>
> any hints?
>
> Following the validator guide I have entered following in the
> validation.xml
>
>             <field property="destinationName" depends="validwhen">
>         <arg0 key="prompt.destinationName"/>
>           <var>
>                  <var-name>test</var-name>
>                  <var-value>(buttonSelected == "find") and
> ((destinationRef    == null) or (*this* != null))</var-value>
>               </var>
>             </field>
>           </form>
>
>
> this works fine for the destinationName field
> I am missing how to specify   destinationReference is ALWAYS required
> except
> When destinationName is NOT null and buttonSelected is 'find'
>
> Anyone can help?
>
> Thanx in advance and regards
> marco



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

Reply via email to