Thank you Erik, n Niall

As per Niall's suggestion, i changed "minLength" to all small
"minlength"...n bingo it worked....
then I also used maxlenght ( with arg1, it also worked).

now this consideration that the variable name should be all small was not
something i could digest, coz we are specifying it in <var-name> tags. ie
we're stating what would be my variable name....So for testing,
i changed variable names with 
1. any other name than minlength,
2. all capital lettered variable name
3. all small lettered
and
4. the 'minLength' again.

And all these worked. 

Now i am more confused than earlier? :(
any thoughts on this....and I couldnt find any info on this behaviour.

Regards,
Akshay
-----Original Message-----
From: Erik Weber [mailto:[EMAIL PROTECTED]
Sent: Saturday, February 19, 2005 8:23 PM
To: Struts Users Mailing List
Subject: Re: Struts validator woes : maxLength minLength


A little-publicized feature (ahem) of Struts 1.1 Validator is that arg1 
has to be paired with minlength and arg2 has to be paired with 
maxlength, as I understand it (last I remember this was true). I don't 
know if this has been changed in more recent versions. You are pairing 
maxlength with arg1 in the example posted. Also, I think the var-name 
needs to be "maxlength", not "maxLength".

Erik


Shah, Akshay wrote:

>Hii All,
>
>I am using Struts 1.1, DynaValidatorForm.
>The required validation is working fine.
>The minlength and maxlength validations are not working for me. ie, wutever
>be the case they always throw the error.
>and I am completely clueless as to why is this happening. Any thoughts
>
>Any thoughts?
>
>Regards,
>Akshay
>
>My Source 
>
>
>validator-rules.xml
>      <validator name="maxlength"
>            classname="org.apache.struts.validator.FieldChecks"
>               method="validateMaxLength"
>         methodParams="java.lang.Object,
>                       org.apache.commons.validator.ValidatorAction,
>                       org.apache.commons.validator.Field,
>                       org.apache.struts.action.ActionErrors,
>                       javax.servlet.http.HttpServletRequest"
>              depends=""
>                  msg="errors.maxlength"/>
>
>
>validation.xml
>    <formset>
>
>        <!-- An example form -->
>       <form name="parentForm">
>           <field property="userName" depends="required,maxlength">
>                                <arg0 key="message.username"/>
>                                <arg1 name="maxlength"
>key="${var:maxLength}" resource="false"/>
>                                <var>
>                                       <var-name>maxLength</var-name>
>                                       <var-value>6</var-value>
>                                </var>
>           </field>
>       </form>
>    </formset>
>
>
>
>struts-en_US.xml
>....
>
>    <form-beans>
>                 <form-bean
>            name="parentForm"
>            type="org.apache.struts.validator.DynaValidatorForm">
>                       <form-property name="userName"
>type="java.lang.String"/>
>               </form-bean>
>    <form-beans>
>|
>|
>|
>         <action       path="/register"
>                               name="parentForm"
>                               validate="true"
>                               scope="session"
>       
>type="com.kandoo.profile.action.registerAction"
>                               input="/profile/pages/register.jsp">
>                               <forward name="success"
>path="/en_US/home/pages/home.jsp" contextRelative="true"/>
>                               <forward name="addChild"
>path="/en_US/profile/pages/childProfile.jsp" contextRelative="true"/>
>                               <forward name="initial"
>path="/en_US/profile/pages/register.jsp" contextRelative="true"/>
>        </action>
>
>
>
>
>
>---------------------------------------------------------------------
>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