wood burning stoves 2.0*
The moose likes Struts and the fly likes validwhen and its use? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "validwhen and its use?" Watch "validwhen and its use?" New topic
Author

validwhen and its use?

Golla Vensiri
Greenhorn

Joined: Aug 05, 2004
Posts: 10
While using vaildwhen in the following example picked up from the Apache site.

<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 there a way to have multiple test conditions. Meaning can we do this:-

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

</field>

It doesn't seem to work. Do we have any other way to accomplish the same.

Thanks.
alan do
Ranch Hand

Joined: Apr 14, 2005
Posts: 354
you need to write your multiple conditions in the same test.

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

</field>


-/a<br />certified slacker...yes, my last name is 'do' - <a href="http://www.luckycouple.com" target="_blank" rel="nofollow">luckycouple.com</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: validwhen and its use?