|
From: Anthony E. <me...@an...> - 2002-01-07 22:19:20
|
FormProc doesn't support multiple validators for an element in the
manner which you have shown below. To use multiple validators you
should use a FormValidatorGroup. A FormValidatorGroup can hold any
number of FormValidators. And since the FormValidatorGroup is a
FormValidator itself you can nest form validators.
The type mapping for the FormValidatorGroup is specified in the
formproc.xml file. I have used the word "group" in the example below.
Thus the proper configuration would be:
<formproc:element name="age">
<formproc:validator type="group">
<formproc:validator type="rule">
<rule>org.formproc.example.IsIntRule</rule>
<formproc:error lang="en">Valid age must be
integer.</formproc:error>
</formproc:validator>
<formproc:validator type="expression">
<pattern>^(2[0-9])$</pattern>
<formproc:error lang="en">Valid age must be between
20-29.</formproc:error>
</formproc:validator>
</formproc:validator>
<formproc:message lang="en">Valid age required.</formproc:message>
</formproc:element>
If you are still having problems then please mention which version of
FormProc you are using in any future messages.
Sincerely,
Anthony Eden
> -----Original Message-----
> From: for...@li...
> [mailto:for...@li...] On
> Behalf Of INFO II
> Sent: Monday, January 07, 2002 1:01 PM
> To: for...@li...
> Subject: [FormProc-developer] multi-validator
>
>
> Hi,
>
> Just a little question regarding "multi-validator" for
> a specific element. Why my example doesn't work?
>
> Here I want to validate first if the "age" is an
> integer, after I would like to validate the range of
> value (20-29). I know if I use only the regexp it's
> enough to do the job, but to do the test of
> "multi-validator", I have tried this.
>
> =======================================================
>
> <formproc:element name="age">
> <formproc:validator type="rule">
> <rule>org.formproc.example.IsIntRule</rule>
> <formproc:error lang="en">Valid age must be
> integer.</formproc:error>
> </formproc:validator>
>
> <formproc:validator type="expression">
> <pattern>^(2[0-9])$</pattern>
> <formproc:error lang="en">Valid age must be
> between 20-29.</formproc:error>
> </formproc:validator>
>
> <formproc:message lang="en">Valid age required.
> </formproc:message>
>
> </formproc:element>
>
>
>
> Each validator have been tested separatly and works
> fine. But together, only the first is tested.
>
>
> Thanks.
>
> __________________________________________________
> Do You Yahoo!?
> Send FREE video emails in Yahoo! Mail!
> http://promo.yahoo.com/videomail/
>
>
> _______________________________________________
> FormProc-developer mailing list
> For...@li...
> https://lists.sourceforge.net/lists/listinfo/formproc-developer
>
|