What's the name of your "Cancel" button? Struts should not validate
if it finds org.apache.struts.taglib.html.CANCEL or
org.apache.struts.taglib.html.CANCEL.x
Take a look at the RequestProcessor.processValidate() code:
if (request.getAttribute(Globals.CANCEL_KEY) != null) {
if (log.isDebugEnabled()) {
log.debug(" Cancelled transaction, skipping validation");
}
return (true);
}
That attribute gets set in RequestProcessor.processPopulate():
// Set the cancellation request attribute if appropriate
if ((request.getParameter(Constants.CANCEL_PROPERTY) != null) ||
(request.getParameter(Constants.CANCEL_PROPERTY_X) != null)) {
request.setAttribute(Globals.CANCEL_KEY, Boolean.TRUE);
}
robert
> -----Original Message-----
> From: Nathan Pitts [mailto:[EMAIL PROTECTED]
> Sent: Thursday, January 29, 2004 6:16 PM
> To: Struts List
> Subject: Validation problem
>
>
> I am wondering how to solve the following problem with a minimal amount
> of recoding, and hope someone can give some input. I have a form the
> has three html:submit buttons -- Update, Cancel and Delete. I am
> using a LookupDispatchAction and an ActionForm with the validation in
> the validate() method. Under normal conditions everything works
> fine......But when a user clicks Update with invalid data on the form,
> the validate method catches the bad data and returns the proper error
> message. If the user then decides to click Cancel (without changing
> the invalid data), the validate() method is still called and the user
> is returned the same error.
>
>
> One thing that I might be able to do is to somehow find out what button
> was clicked in the validate() method...?? How would I do that, I
> wonder...
>
>
>
> thanks in advance,
> -nathan
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]