aspose file tools*
The moose likes Struts and the fly likes Bypass client-side struts validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Bypass client-side struts validation" Watch "Bypass client-side struts validation" New topic
Author

Bypass client-side struts validation

Karthik Srinivas
Greenhorn

Joined: May 07, 2008
Posts: 12
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

Joined: Feb 15, 2005
Posts: 4864
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 ]

Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Bypass client-side struts validation