• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Struts2 - Conditional validation

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have tabs created using jquery in a struts2 form. At a given point of time, I will enter values for fields in any one of the tab and submit it. Rest of the tabs' fields will be blank. I have validation rule set for all the fields in all the tabs using action-validation.xml. So the validation is fired for all fields - as all the tabs& fields are in one <form>.

Stating this, Can I control the validation to only one tab and ignore other tab fields in action-validation.xml? We have something called depends="validwhen" in struts 1.x. Do we have something like that in struts2? the short-circuit is useful only to ignore rest of the validation set for a single field. correct me if i am wrong. Bottom line is, even though my form submits all the fields, I want my action-validation.xml to validate only the fields in active tab. Any thoughts?

Please let me know.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Expression validation can validate against any OGNL expression.

That said, it might be easier and/or more maintainable to do complicated validation in Java, possibly combined with XML- or annotation-based validation. Just keep a hidden value indicating which tab you're on.
 
Run away! Run away! Here, take this tiny ad with you:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic