struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd Nine <todd.n...@gmail.com>
Subject Re: Complex Validation with validwhen and large condition
Date Tue, 01 Mar 2005 15:31:58 GMT
Thanks Niall, that took care of it.  We just had to convert the ANDs
and ORs to lower case to conform to the grammer.

Todd


On Fri, 25 Feb 2005 20:14:54 -0000, Niall Pemberton
<niall.pemberton@blueyonder.co.uk> wrote:
> The condition you have specified means that addressLine1 is only valid when
> everything is not null. Thats why you always get the error - you need an OR
> condition. In order to get appropriate "required" messages for the various
> fields, how about something along the following lines....
> 
> <field property="addressLine1">
>     <var> <var-name>test</var-name>
>         <var-value>( (this != null) OR (
>               (addressLine2 == null) AND
>               ((city == null) AND
>               ((state == null) AND
>               ((zip == null) AND
>               ((zip4 == null) AND
>               (country == null))))))
>         </var-value>
>     </var>
> </field>
> <field property="city">
>     <var> <var-name>test</var-name>
>         <var-value>((this != null) OR (addressLine1 == null))</var-value>
>     </var>
> </field>
> <field property="state">
>     <var> <var-name>test</var-name>
>         <var-value>((this != null) OR (addressLine1 == null))</var-value>
>     </var>
> </field>
> <field property="zip">
>     <var> <var-name>test</var-name>
>         <var-value>((this != null) OR (addressLine1 == null))</var-value>
>     </var>
> </field>
> <field property="country">
>     <var> <var-name>test</var-name>
>         <var-value>((this != null) OR (addressLine1 == null))</var-value>
>     </var>
> </field>
> 
> Niall
> 
> ----- Original Message -----
> From: "Todd Nine" <todd.nine@gmail.com>
> To: "Struts Users Mailing List" <user@struts.apache.org>
> Sent: Friday, February 25, 2005 7:21 PM
> Subject: Complex Validation with validwhen and large condition
> 
> > Hi all,
> >    I'm having some issues getting validwhen to perform the way I want
> > it to.  I would like the following general functionality.
> >
> > 1. The user can input an aseAddress.
> > 2. The address as a whole is nullable, however if they fill in any of
> > the fields, they must filling ALL of the address fields.
> >
> > Here are my properties
> >
> > aseAddress.addressLine1
> > aseAddress.addressLine2
> > aseAddress.city
> > aseAddress.state
> > aseAddress.zip
> > aseAddress.zip4
> > aseAddress.country
> >
> >
> > addressLine2 and zip4 are not required.  However, if any field in the
> > list above contains data, then all of the fields except for
> > addressLine2 and zip4 are required.
> >
> > Here is an example contition I have tried, but I contantly get that
> > the fields are required, even when they are all empty.  If anyone who
> > has a better way, please let me know.
> >
> >
> >
> > <field property="aseAddress.addressLine1" depends="validwhen, mask">
> > <arg0 key="prompt.common.addressLine1" />
> > <var>
> > <var-name>mask</var-name>
> > <var-value>${allvalid}</var-value>
> > </var>
> > <var>
> > <var-name>test</var-name>
> > <var-value>
> > (
> > (
> > (
> > (
> > (
> > (
> > (*this* != null)
> > and (aseAddress.addressLine2 != null)
> > ) and (aseAddress.city != null)
> > ) and (aseAddress.state != null)
> > ) and (aseAddress.postalCode4 != null)
> > ) and (aseAddress.country != null)
> > ) and (aseAddress.postalCode != null)
> > )
> > </var-value>
> > </var>
> > </field>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message