jQuery in Action, 3rd edition
The moose likes Struts and the fly likes validwhen struts ??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "validwhen struts ???" Watch "validwhen struts ???" New topic

validwhen struts ???

Gayatri Ganesh
Ranch Hand

Joined: Dec 23, 2003
Posts: 143

I have 2 fields on my screen, 1 is a textfield and the other is a drop-down.
When the drop-down has values A or B or C, the value allowed in the textfield should be a long only.
When the user selects anything else other than A,B,C from drop-down, the textfield can contain anything.

I am trying to use validwhen.

<field property="selectedDropDownItem" depends="validwhen">
<msg key="error.invalid" name="validwhen"/>
<var-value>( ((*this* == 'A' ) and (id == [a-zA-Z])) or ((*this* == 'B' ) and (id == [a-zA-Z])) or ((*this* == 'C' ) and (id == [a-zA-Z])))</var-value>
id=[a-zA-Z] doesnt work nor does id =long.
How do I give id field a different validation rule only when selectedDropDownItem = A or B or C ?

Any help will be apprecaited.

I agree. Here's the link: http://aspose.com/file-tools
subject: validwhen struts ???
It's not a secret anymore!