Why get complicated? All you need is <html:cancel/> and the validation will automatically not be executed. Even the javascript validation if you are using DynaValidatorForm.

Adam

On 10/07/2003 04:27 PM Glenn Holmer wrote:
Frederic Dernbach wrote:

Glenn,

- Use a descendant of DispatchAction for your form's action,
- Have two separate methods in the action class for your two buttons
(one for 'commit' and one for 'cancel').
- In the struts-config.xml file, specify attribute 'validate' to 'false'
for your form's action.The form validation wont't happen automatically
this way.
- In the method for the 'commit' button, call explicitely 'validate' on
your form. But not in the method associated to the cancel button.


Thanks, I got that to work without resorting to a DispatchAction
like this:

    if (confirm.equals(cancel)) {
      forward = "complete";
    } else {
      errors = dynaForm.validate(mapping, request);
      if (errors.size() > 0) {
        request.setAttribute("org.apache.struts.action.ERROR", errors);
        forward = "failure";
      }
    }

Is that the right way to put the errors in play?


-- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to