yes Rick....as exactly like what you mentioned what I did is first I just called 
super.validate() in my validate method of ActionForm then did the custon 
validation...btw is there any way in which I can validate those fields in framework 
itself..??? one like NotRequiredIf...??

like I should restrict the user to enter either CreditCardId text box or radio button 
which represent NoCreditCardId and not both If so I should throw err msg.

-Ram


-----Original Message-----
From: Rick Reumann [mailto:[EMAIL PROTECTED]
Sent: Thursday, November 06, 2003 12:13 AM
To: Struts Users Mailing List
Subject: Re: Struts-Validation


Ramadoss Chinnakuzhandai wrote:
> yes....I should restrict the user to enter both fields i.e they should enter anyone 
> of the fields and not both.

These option I think is to use the validate method in your 
ActionForm and then first call your validation framework and then do 
  the check for the custom stuff you need to take care of....

public ActionErrors validate(ActionMapping mapping,
                                  HttpServletRequest request) {

         ServletContext application = getServlet().getServletContext();
         ActionErrors errors = new ActionErrors();

//parameter will tell it what validation to look at
         String parameter = request.getParameter( 
mapping.getParameter() );

         Validator validator = Resources.initValidator( parameter, 
this, application, request,  errors, page);

         try {
             validatorResults = validator.validate();
         } catch (ValidatorException e) {
             log.error(e.getMessage(), e);
         }

//!! now do the custom stuff.. comparing the fields etc and add
//any more errors to errors
        

        return errors;
     }

-- 
Rick


---------------------------------------------------------------------
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]

Reply via email to