Thanks Rick for the response.
My first issue Rick is that my validate function in the form is not getting
called at all.
I have simply put a "System.out.println" statement there to verify that it
is getting called.

What you have given is definitely useful for me in the second step :-) But I
need to get the first step correct... that is to make sure my validate
function is being called in addition to validation.xml rules.

Could you help me with that?

Thanks.
Raghu



On 1/20/06, Rick Reumann <[EMAIL PROTECTED]> wrote:
>
> Raghu Kanchustambham wrote the following on 1/20/2006 9:22 AM:
> > Hi,
> > When I want to retain validation.xml for validation of most of my fields
> on
> > the form. However, the rules for one particular field is too complex to
> be
> > done with just the validation.xml. I intend to check for it in the
> > validation form action. What I see is that the action form's validate
> > function is not getting called.
>
> Here's how I've done it in the past. There might be a better way:
>
> //in form Validate method...
>
> ServletContext application = getServlet().getServletContext();
>
> ActionErrors errors = new ActionErrors();
>
> 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 you manual validation say on age
> String prop = request.getParameter("prop");
> if ( //some test on prop) {
>     errors.add(ActionMessages.GLOBAL_MESSAGE, new
> ActionError("errors.something", "Prop"));
> }
>
> return errors;
>
> --
> Rick
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to