Thanks, I am doing just that.

Just a quick question, how do I use the property name as the error key
in the validate() method?

I have this but it uses the form name as the key, not the name of the
property currently validating.

public ActionErrors validate(ActionMapping mapping, HttpServletRequest
request) {
     ActionErrors errors = new ActionErrors();
     String validationKey = getValidationKey(mapping, request);
     
     errors.add(validationKey, new ActionMessage("errors.input"));
     
     return errors;
}

Thanks

On Fri, 10 Dec 2004 09:34:26 -0600, Hubert Rabago <[EMAIL PROTECTED]> wrote:
> I would think so, but you'd have to call Validator yourself.  Take a
> look at how the ValidatorForm#validate() calls it, and base your
> nested.validate() code on that.  After the call, append the errors
> from your main form and those in your nested form.
> 
> 
> 
> On Fri, 10 Dec 2004 10:41:36 +1100, Ben <[EMAIL PROTECTED]> wrote:
> > If I do this, can I use Struts validators and my custom validate method?
> >
> >
> >
> >
> > On Thu, 9 Dec 2004 16:08:03 -0600, Hubert Rabago <[EMAIL PROTECTED]> wrote:
> > > Why not call nested.validate() inside NormalForm#validate(), then add
> > > the appropriate ActionMessage objects in the resulting ActionErrors?
> > >
> > >
> > >
> > >
> > > On Fri, 10 Dec 2004 08:57:17 +1100, Ben <[EMAIL PROTECTED]> wrote:
> > > > Hi
> > > >
> > > > Within my normal form there is a nested form. The nested form has
> > > > custom validation. The validate attribute of the action is set to
> > > > false. My question is how do I validate the normal form and
> > > > automatically validate the nested form with my custom validation
> > > > method?
> > > >
> > > > E.g.
> > > >
> > > > NormalForm () {
> > > > NestedForm nested = new NestedForm();
> > > > }
> > > >
> > > > NestedForm () {
> > > > validate(...) {
> > > > // checking the data here
> > > > }
> > > > }
> > > >
> > > > So my action would validate the form as:
> > > >
> > > > MyAction () {
> > > > NormalForm nForm = (NormalForm) form;
> > > > ActionErrors errors = nForm.validate(); // Validate the data
> > > > }
> > > >
> > > > The problem here is that it validates the NormalForm and ignores my
> > > > validation in the NestedForm.
> > > >
> > > > I hope this question makes sense to you... :)
> > > >
> > > > Thanks,
> > > > Ben
> > > >
> > > > ---------------------------------------------------------------------
> > >
> > >
> > > > 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]
> 
>

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

Reply via email to