You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Kalcevich, Daniel" <dk...@firstam.com> on 2006/01/31 17:06:22 UTC
Valid When Question
Everyone,
I have a question regarding the Valid When. I have 3 fields for phone
number (declared as phone1, phone2, phone3). Now, the field as a whole
is not required, however, if a user enters in some data, I want to make
sure they enter in values for all 3. So, on a validWhen I would want
the logic to be "its required when data is entered in either of the
other two fields". Can someone give any advice into how I can declare
this in my validator XML file? Thanks.
Daniel
Re: Valid When Question
Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
Maybe something like the following....
<field property="phone1" depends="validwhen">
<var>
<var-name>test</var-name>
<var-value>((*this* != null) or ((phone2 == null) and (phone3 ==
null)))</var-value>
</var>
</field>
<field property="phone2" depends="validwhen">
<var>
<var-name>test</var-name>
<var-value>((*this* != null) or ((phone1 == null) and (phone3 ==
null)))</var-value>
</var>
</field>
<field property="phone3" depends="validwhen">
<var>
<var-name>test</var-name>
<var-value>((*this* != null) or ((phone1 == null) and (phone2 ==
null)))</var-value>
</var>
</field>
Niall
----- Original Message -----
From: "Kalcevich, Daniel" <dk...@firstam.com>
To: <us...@struts.apache.org>
Sent: Tuesday, January 31, 2006 4:06 PM
Subject: Valid When Question
Everyone,
I have a question regarding the Valid When. I have 3 fields for phone
number (declared as phone1, phone2, phone3). Now, the field as a whole
is not required, however, if a user enters in some data, I want to make
sure they enter in values for all 3. So, on a validWhen I would want
the logic to be "its required when data is entered in either of the
other two fields". Can someone give any advice into how I can declare
this in my validator XML file? Thanks.
Daniel
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org