aspose file tools
The moose likes Struts and the fly likes struts validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Groovy Fundamentals video training course this week in the Groovy forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts validation" Watch "struts validation" New topic

struts validation

vas reddy

Joined: Jun 11, 2008
Posts: 23
Please let me know if we can validate fields that depend on the value of another field.

For example, I want to validate newAmtbooked and newDate only when submitType equal to 'save'. I am passing submitType value from my jsp and typical values for my submitType are 'save', 'fetch', 'link' etc.. If I pass otherthan 'save' as my submitType, I want to skip the validation.

<field indexedListProperty="newAmtbooked" depends="required,double">
<arg0 key="newAmtbooked"/>

<field indexedListProperty="newDate" depends="required,date">
<arg0 key="newDate"/>

Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
You may be able to do this using the "validWhen" rule. See the Struts Validator Guide for details.

Consultant, Sima Solutions
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: struts validation