| 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
|
 |
 |
|
|
subject: Bypass client-side struts validation
|
|
|