aspose file tools*
The moose likes Struts and the fly likes Confusing validwhen rule Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Confusing validwhen rule" Watch "Confusing validwhen rule" New topic
Author

Confusing validwhen rule

Velika Srbija
Ranch Hand

Joined: Jan 15, 2002
Posts: 172
There is an excerpt from the Struts Validator Guide:
------------------------------------
As an example of how this would work, consider a form with fields sendNewsletter and emailAddress. The emailAddress field is only required if the sendNewsletter field is not null. You could code this using the validwhen rule as:


<field property="emailAddress" depends="validwhen">
<arg0 key="userinfo.emailAddress.label"/>
<var>
<var-name>test</var-name>
<var-value>((sendNewsletter == null) or (*this* != null))</var-value>
</var>
</field>

Which reads as: this field is valid if sendNewsletter is null or the field value is not null.
------------------------------------

Is this condition OK?
Any moe detailed explanation.?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Confusing validwhen rule