*
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "validwhen struts ???" Watch "validwhen struts ???" New topic
Author

validwhen struts ???

Gayatri Ganesh
Ranch Hand

Joined: Dec 23, 2003
Posts: 143
Hi,

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>
<var-name>test</var-name>
<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>
</var>
</field>
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.

Thanks,
Gayatri
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: validwhen struts ???