This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Bypass client-side struts validation

 
Karthik Srinivas
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found many topics related to bypassing struts validation, but they dealt with server-side validation. I have a query reg. client-side validation
**************************************************************************

I have a form with around 10 fields. I have enabled client-side validation in Struts by specification in validator-rules.xml. I have two submit buttons, which I process at the backend using LookupDispatchAction. Now, only when I click one submit, I want the validator to validate the 10 fields. If I click other submit button, the the validation shouldn't happen. How to achieve it?

Please help. Thanks in advance.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd suggest using the <html:cancel> tag to render the button that bypasses validation. This is still a submit button, but it just tells Struts not to process validation when it is pressed (Both server-side and client-side). If you write a method named cancelled in your DispatchAction, it will be called when the cancel button is pressed. Also note that if you're using Struts 1.2.9 or above, you must specify cancellable="true" in the Action mapping.
[ June 20, 2008: Message edited by: Merrill Higginson ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic