Can you override the validate() method in your form that extends ValidatorForm,
and then inside that do something like this?
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request)
{
ActionErrors errors = null;
if ( request.getParameter("closeButton") == null ) {
// close button not pressed - so validate
errors= super.validate(mapping,request);
}
return errors;
} // validate()
-----Original Message-----
From: Caroline Jen [mailto:[EMAIL PROTECTED]
Sent: Sun 7/30/2006 12:44 AM
To: [email protected]
Cc:
Subject: Conditional Validation
I am using the Struts validation.xml to check if
clients leave any of the required text fields in the
form blank.
I prepared two action mappings for this web page. The
'validate'attribute is set to "false" for the first
action mapping because when I have the web page
displayed in the browserat the first time, I do not
want to perform the validation check.
The 'validate' attribute is set to "true" for the
second action mapping so that validation is performed
if clients click on the "Submit" button.
So far so good.
But, there is also a "Close" button in the web page.
If the 'Close' button is clicked, the previous web
page is supposed to be displayed.
Clients are not expected to fill out the form should
they choose to click on the 'Close' button. What
should I do if I do not want to perform the validation
check if the 'Close' button is clicked?
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
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]