You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Emerson Cargnin - MSA <em...@sicredi.com.br> on 2002/05/17 16:14:40 UTC

validation approaches

What are u people using to validate form data in client and server without
rewriting code?  I know validator does that, although this approach doesn't
allows complex validation (as calculated validation digits). It looks like a
few people are using validator... (please correct me if I'm wrong)

Regards
Emerson


----- Original Message -----
From: "Evan Schnell" <es...@nvisia.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Friday, May 17, 2002 10:52 AM
Subject: Re: Validator Tag with with Struts 1.1.b1


> David Morris wrote:
>
> >Validators,
> >
> >Any idea how I can use this with the 1.1 beta or do I need to use
> >another version? Also, can someone point me to a working example of
> >validation with a 1.1 version of Struts?
> >
> >
> Validation is poorly documented,  the javadoc is even missing from the
> nightlies, but I was able to get it working under 1.1b1 for a demo last
> week. I completely ignored the contrib directory because everything is
> available in the main distribution and the html taglib.
>
> 1. struts-config.xml needs only the following (make sure the files
> exist):
>   <message-resources
>     parameter="ApplicationResources"/>
>
>   <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
>     <set-property property="pathname"
> value="/WEB-INF/validation-rules.xml"/>
>     <set-property property="pathname" value="/WEB-INF/validation.xml"/>
>   </plug-in>
>
> 2. I specified rules in validation.xml consistent with the old examples.
>
>  This doesn't seem to have changed.
>
> 3. Be sure your applicationResources.properties file has a set of
> messages beginning with "error."  These can be copied over from examples
>
> if they are missing.
>
> 4. Set validate to true on your forms.
>
> 5. Make your forms extend:
>  org.apache.struts.validator.ValidatorActionForm.  Until you get things
> working I suggest you comment out any existing validate method in your
> form class.
>
> 6. Add the tag  <html:javascript formName="registerForm"/> somewhere
> near the top.  I put it above a random body tag that was in the html I
> was using.
>
> 7. Add the event:  onsubmit="return validateRegisterForm(this);" to your
>
> html:form tag.
>
> It is important that all of your form names in the event, the javascript
>
> tag and struts-config.xml match in order for the javascript validation
> to work properly.
>
> Have fun,
> Evan.
>
> --
> Evan Schnell, Technical Lead
> nVISIA, Twin Cities  "Digital Architecture and Construction"
> 2 Meridian Crossings, Richfield, MN 55423
> Voice: 612.243.2460 -- Fax: 612.243.2468 -- Mobile: 612.232.5972
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: validation approaches

Posted by James Mitchell <jm...@telocity.com>.
I guess that depends on where you draw the line on customization.

If you can build a tool that handles your needs in a 'generic' fashion.
Then by all means, help us out and donate it.

However, if you app requires special validation handling, then customize the
app to do so.


JM

> -----Original Message-----
> From: Emerson Cargnin - MSA [mailto:emersonc@sicredi.com.br]
> Sent: Friday, May 17, 2002 10:15 AM
> To: Struts Users Mailing List
> Subject: validation approaches
>
>
> What are u people using to validate form data in client and server without
> rewriting code?  I know validator does that, although this
> approach doesn't
> allows complex validation (as calculated validation digits). It
> looks like a
> few people are using validator... (please correct me if I'm wrong)
>
> Regards
> Emerson
>
>
> ----- Original Message -----
> From: "Evan Schnell" <es...@nvisia.com>
> To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> Sent: Friday, May 17, 2002 10:52 AM
> Subject: Re: Validator Tag with with Struts 1.1.b1
>
>
> > David Morris wrote:
> >
> > >Validators,
> > >
> > >Any idea how I can use this with the 1.1 beta or do I need to use
> > >another version? Also, can someone point me to a working example of
> > >validation with a 1.1 version of Struts?
> > >
> > >
> > Validation is poorly documented,  the javadoc is even missing from the
> > nightlies, but I was able to get it working under 1.1b1 for a demo last
> > week. I completely ignored the contrib directory because everything is
> > available in the main distribution and the html taglib.
> >
> > 1. struts-config.xml needs only the following (make sure the files
> > exist):
> >   <message-resources
> >     parameter="ApplicationResources"/>
> >
> >   <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
> >     <set-property property="pathname"
> > value="/WEB-INF/validation-rules.xml"/>
> >     <set-property property="pathname" value="/WEB-INF/validation.xml"/>
> >   </plug-in>
> >
> > 2. I specified rules in validation.xml consistent with the old examples.
> >
> >  This doesn't seem to have changed.
> >
> > 3. Be sure your applicationResources.properties file has a set of
> > messages beginning with "error."  These can be copied over from examples
> >
> > if they are missing.
> >
> > 4. Set validate to true on your forms.
> >
> > 5. Make your forms extend:
> >  org.apache.struts.validator.ValidatorActionForm.  Until you get things
> > working I suggest you comment out any existing validate method in your
> > form class.
> >
> > 6. Add the tag  <html:javascript formName="registerForm"/> somewhere
> > near the top.  I put it above a random body tag that was in the html I
> > was using.
> >
> > 7. Add the event:  onsubmit="return validateRegisterForm(this);" to your
> >
> > html:form tag.
> >
> > It is important that all of your form names in the event, the javascript
> >
> > tag and struts-config.xml match in order for the javascript validation
> > to work properly.
> >
> > Have fun,
> > Evan.
> >
> > --
> > Evan Schnell, Technical Lead
> > nVISIA, Twin Cities  "Digital Architecture and Construction"
> > 2 Meridian Crossings, Richfield, MN 55423
> > Voice: 612.243.2460 -- Fax: 612.243.2468 -- Mobile: 612.232.5972
> >
> >
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>