A patch recently went into the various flavours of validator forms which
split out the logic which determines the validation "key" into a separate
method - so if you look at the current versions of either
ValidatorActionForm or DynaValidatorActionForm - they now only contain a
very simple getValidationKey(request, mapping) method.

http://cvs.apache.org/viewcvs.cgi/jakarta-struts/src/share/org/apache/struts/validator/

I use a version of  DynaValidatorActionForm which removes the leading "/" -
for Adam's problem (where he has "/esurvey/survey/update") he could do that
and replace the other slashes with underscores:

public class MyDynaValidatorActionForm extends DynaValidatorForm
                          implements DynaBean, Serializable {

  public String getValidationKey(ActionMapping mapping,
                                   HttpServletRequest request) {

        mapping.getPath().substring(1).replace('/', '_');

  }
}

Then, in validation.xml

       <formset>
            <form name="esurvey_survey_update">
                 <field ..........>
            </form>

and on the jsp page:

    <html:javascript formName="esurvey_survey_update"/>

If you can't use the latest build of struts, then copy the validate() method
which calls getValidationKey() - when the next proper "release" of struts
comes out, you can then delete the validate() method just leaving
getValidationKey().

Niall


----- Original Message ----- 
From: "Adam Hardy" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Thursday, April 08, 2004 8:02 PM
Subject: Re: DynaValidatorActionForm client-side validation


> Hmmm, good question. I had this problem, but never managed to solve it.
> I thought I was doing something wrong but I couldn't work it out.
> Eventually I changed to DynaValidatorForm, which wasn't a big problem
> because there were only 2 or 3 forms where I wanted to use the same
> DynaForm but different validation.
>
> Perhaps someone actually knows if there is a solution?
>
>
>
> On 04/08/2004 11:16 AM Igor Antonacci wrote:
> > Hi All,
> > I'm working on DynaValidatorActionForm client-side validation but I've
> > some problems about.
> >
> > Everything is working but, as DynaValidatorActionForm maps validation
> > rules with Action path attribute, Struts generates a client side
> > validation method name with a "/" character.
> >
> > It is because Action path has a "/" as first character.
> >
> > How do I solve this issue ?
> >
> > Thanks,
> > Igor.
> >
> > ------------------------------
> > Callidus Software
> > Igor Antonacci
> > Core Engineer
> > [EMAIL PROTECTED]
> > ------------------------------
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> -- 
> struts 1.2 + tomcat 5.0.19 + java 1.4.2
> Linux 2.4.20 Debian
>
>
> ---------------------------------------------------------------------
> 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