You mean the validator xml file?

<constant>
        <constant-name>non_whitespace</constant-name>
        <constant-value>^\S+$</constant-value>
</constant>  
<field
        property="a"
        depends="validwhen,mask">
        <arg0 key="a.error_label"/>
        <var>
                <var-name>test</var-name>
                <var-value>((b == 'false') or (*this* != null))</var-value>
        </var>
        <var>
                <var-name>mask</var-name>
              <var-value>${non_whitespace}</var-value>
        </var>  
</field> 

Field B is a check box.
Field A is a textbox.

-Betty

-----Original Message-----
From: Matt Bathje [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 06, 2005 2:30 PM
To: Struts Users Mailing List
Subject: Re: ValidWhen validation


Betty Koon wrote:
> It's Server side.
> 
> -Betty
> 
> -----Original Message-----
> From: Matt Bathje [mailto:[EMAIL PROTECTED]
> Sent: Thursday, January 06, 2005 2:15 PM
> To: Struts Users Mailing List
> Subject: Re: ValidWhen validation
> 
> 
> Betty Koon wrote:
> 
>>My question is even if I type 123 in the field, it still complains
>>about the field is required??  I am really confused now ...
>>
> 


So I just attempted to duplicate what you are doing with this validation:

<field property="firstName" depends="validwhen,mask">
   <arg0 key="label.firstName" />       
     <var>
       <var-name>test</var-name>
       <var-value>((lastName == 'false') or (*this* != null))</var-value>
     </var>
     <var>
       <var-name>mask</var-name>
       <var-value>^123$</var-value>
     </var>
</field>

and it seems to work as expected.

lastName=false; firstname=(blank): submits
lastName=false; firstname=123: submits
lastName=false; firstName=asdf: invalid firstName error lastName=(blank);
firstname=(blank): firstname is required error lastname=(blank);
firstname=123: submits lastname=(blank); firstname=asdf: invalid firstname
error


So....something else hinky must be going on. Can you post the validator 
code again?


Matt

---------------------------------------------------------------------
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