commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeremy Tan" <jeremy...@scualum.com>
Subject validator bug or correct behavior?
Date Wed, 02 Oct 2002 22:53:04 GMT
Hi David and all,

I'm using the i18n features of the validator using Struts 1.1b2, I found that the validation
is done for each field of a form for default locale, and also each "overloaded" field specified
by a formset of another locale.  However, if an additional rule/field is added for a particular
locale, the validation for that is not being picked up by the validator.  I was wondering
if that is the default behavior, or is that a bug?  I don't know if i'm explaining myself
right, so here's an example from the struts-validator.war file.

I noticed that if i commented out the addr field on the default, but left it there for the
"fr" locale.  The "fr" one (addr) doesn't get picked up, it seems like the validator only
validates all the fields that's specified by the default, nothing more.  What if we need extra
fields that requires different validations for different locales??

<formset>
 <form    name="registrationForm">
         <field    property="firstName"
             depends="required,mask,minlength">
               <arg0 key="registrationForm.firstname.displayname"/>
               <arg1 name="minlength" key="${var:minlength}" resource="false"/>
                     <var>
                       <var-name>mask</var-name>
                       <var-value>^\w+$</var-value>
                     </var>
                     <var>
                       <var-name>minlength</var-name>
                       <var-value>5</var-value>
                     </var>
         </field>
         <field    property="lastName"
             depends="required,mask,maxlength">
               <msg name="mask" key="registrationForm.lastname.maskmsg"/>
               <arg0 key="registrationForm.lastname.displayname"/>
               <arg1 name="maxlength" key="${var:maxlength}" resource="false"/>
                     <var>
                       <var-name>mask</var-name>
                       <var-value>^[a-zA-Z]*$</var-value>
                     </var>
                     <var>
                       <var-name>maxlength</var-name>
                       <var-value>10</var-value>
                     </var>
         </field>
         <!--
         <field    property="addr"
             depends="required">
               <arg0 key="registrationForm.addr.displayname"/>
         </field> 
          -->
         . . .
   </form>
</formset>
<formset language="fr">
 <form    name="registrationForm">
         <field    property="firstName"
             depends="required,mask,minlength">
               <arg0 key="registrationForm.firstname.displayname"/>
               <arg1 name="minlength" key="${var:minlength}" resource="false"/>
                     <var>
                       <var-name>mask</var-name>
                       <var-value>^\w+$</var-value>
                     </var>
                     <var>
                       <var-name>minlength</var-name>
                       <var-value>5</var-value>
                     </var>
         </field>
         <field    property="lastName"
             depends="required,mask,maxlength">
               <msg name="mask" key="registrationForm.lastname.maskmsg"/>
               <arg0 key="registrationForm.lastname.displayname"/>
               <arg1 name="maxlength" key="${var:maxlength}" resource="false"/>
                     <var>
                       <var-name>mask</var-name>
                       <var-value>^[a-zA-Z]*$</var-value>
                     </var>
                     <var>
                       <var-name>maxlength</var-name>
                       <var-value>10</var-value>
                     </var>
         </field>
  
         <field    property="addr"
             depends="required">
               <arg0 key="registrationForm.addr.displayname"/>
         </field>
         . . .
   </form>
</formset>


Can someone please take a look, and reply to me, as i'm not subscribed to the mailing list.

Thanks,

-JJeremy
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message