• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

struts validation

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
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>

<field indexedListProperty="newDate" depends="required,date">
<arg0 key="newDate"/>
<var>
<var-name>datePatternStrict</var-name>
<var-value>MM/dd/yyyy</var-value>
</var>
</field>

thanks
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You may be able to do this using the "validWhen" rule. See the Struts Validator Guide for details.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic