struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd Nine <todd.n...@gmail.com>
Subject Complex Validation with validwhen and large condition
Date Fri, 25 Feb 2005 19:21:01 GMT
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


Mime
View raw message