Assuming you've turned off the automatic validation (validate="false" in 
struts-config.xml), then you can programmatically determine which button was 
pressed in your execute() method, via request.getParameter("btn_cancel") for 
example, then decide not to call something.

public ActionForward execute (...) {
   if ( request.getParameter("btn_cancel") == null ) {
      // didn't press [Cancel]
      ActionMessages errors = form.validate(mapping,request);
      if ( ! errors.isEmpty() ) {
         saveErrors(request, errors);
   ...

Also, if using javascript, you can turn-off validation when the cancel button 
is pressed by setting bCancel=true (I think).

Good luck.

-----Original Message-----
From: Vaylee Mckenzie-Daniels (VA) [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 06, 2006 9:02 AM
To: user@struts.apache.org
Subject: RE: Action based client validation





> I am struggling to find resources on how to enable the validation
> only when submit is selected. Validation should not be done when
> cancel is selected.
>

> Please help.
>

> Thx
> Vaylee


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This e-mail and its contents are subject to the Telkom SA Limited
e-mail legal notice available at

http://www.telkom.co.za/TelkomEMailLegalNotice.PDF
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

Reply via email to