I had a similar requirement, only I was checking the value on my
<html:submit.... > buttons.  I overrode the validate method for my
DynaValidatorActionForm, and then figured out how to go ahead and invoke
validator only for the 'continue' value.  HTH.

<snip>

public class InsertForm extends DynaValidatorActionForm
{
        public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request)
        {
                ServletContext context = getServlet().getServletContext();
                ActionErrors errors = new ActionErrors();
                
                String submitAction = (String) get("submitAction");
                if ((submitAction.equalsIgnoreCase("continue")) ||
(submitAction.equalsIgnoreCase("submit")))
                {
                        /**
                        * call Validator if submitAction is 'continue' or
'submit'.  Validator will return errors
                        * in the 'errors' object if any validation fails...
                        */
                        Validator validator =
StrutsValidatorUtil.initValidator(mapping.getPath(), this, context, request,
errors, page);
                        try
                        {
                                validatorResults = validator.validate();
                        }
                        catch(ValidatorException ve)
                        {}
                }
                
                return errors;
        }
}

</snip>

Jerry

> -----Original Message-----
> From: Aladar The Dinosaur [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, October 02, 2002 9:48 PM
> To: Struts Users Mailing List
> Subject: Usage of ValidatorActionForm
> 
> 
> Hello,
> 
> I have an actionForm initialized in an action before it gets 
> routed to the
> jsp. The jsp contains <html:errors/> tag that displays 
> validation errors
> when it first comes up. I want to prevent validating the 
> rules when it first
> come up (for example when "/test.do?action=init"  gets 
> executed. I would
> like to validate the form when the form is submitted.
> 
> It seems like I should be extending ValidatorActionForm rather than
> ValidatorForm, and place some logic in the action. However, I 
> don't know
> where to find such information. Can someone offer help?
> 
> Thank you,
> Scott
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 
> 

This transmission (and any information attached to it) may be confidential and is 
intended solely for the use of the individual or entity to which it is addressed. If 
you are not the intended recipient or the person responsible for delivering the 
transmission to the intended recipient, be advised that you have received this 
transmission in error and that any use, dissemination, forwarding, printing, or 
copying of this information is strictly prohibited. If you have received this 
transmission in error, please immediately notify LabOne at (800)388-4675.



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

Reply via email to