• 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
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Bypass client-side struts validation

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
The City calls upon her steadfast protectors. Now for a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic