You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Xavier Vanderstukken <xv...@ionicsoft.com> on 2006/03/09 11:05:06 UTC

Validation warning under firefox 1.5

The javascript generates by Struts 1.3 to integrate the common-validator 
js produces warnings under ff1.5 :

Avertissement : reference to undefined property this[varName]

this.a0 = new Array("password", "Password can not be less than {1} characters.",new Function ("varName", "this.minlength='6';  return this[varName];"));
this.a1 = new Array("passwordbis", "Password confirmation can not be lessthan {1} characters.", new Function ("varName", "this.test='(*this*==password)';
this.minlength='6';  return this[varName];"));


The second problem (but it may be linked to this warning) is that the alert popup indicates : 

Password can not be less than {1} characters. instead of Password can not be less than 6 characters.


<field property="password" depends="required,minlength">
                <arg key="user.password"/>
                <var>
    				<var-name>minlength</var-name>
    				<var-value>6</var-value>
   				</var>
            </field>

However all the others validation rules are working well


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Validation warning under firefox 1.5

Posted by Xavier Vanderstukken <xv...@ionicsoft.com>.
Thx I forgot to add the line : <arg name="minlength" 
key="${var:minlength}" resource="false" position="1"/> to my 
configuration file.
But I have allways the javascript warning under firefox 1.5 (I am using 
Struts 1.3) :

*Avertissement : reference to undefined property this[varName]
*

Niall Pemberton wrote:

>I don't see any warnings when I try out the struts-examples webapp (latest
>1.2.x version) with Firefox 1.5 - in the validator examples the "Javascript
>Registration Form" uses minlength on the name fields and it worked with no
>problem.
>
>The problem with your error message is that you're not specifying any
>replacement "argument" values for the message. It doesn't automatically pick
>up the <var> values and use them as argument replacements. You need to have
>something like the following....
>
> <field property="password" depends="required,minlength">
>    <arg key="user.password"/>
>    <arg name="minlength" key="${var:minlength}" resource="false"
>position="1"/>
>    <var>
>        <var-name>minlength</var-name>
>        <var-value>6</var-value>
>    </var>
></field>
>
>Niall
>
>----- Original Message ----- 
>From: "Xavier Vanderstukken" <xv...@ionicsoft.com>
>Sent: Thursday, March 09, 2006 10:05 AM
>
>
>  
>
>>The javascript generates by Struts 1.3 to integrate the common-validator
>>js produces warnings under ff1.5 :
>>
>>Avertissement : reference to undefined property this[varName]
>>
>>this.a0 = new Array("password", "Password can not be less than {1}
>>    
>>
>characters.",new Function ("varName", "this.minlength='6';  return
>this[varName];"));
>  
>
>>this.a1 = new Array("passwordbis", "Password confirmation can not be
>>    
>>
>lessthan {1} characters.", new Function ("varName",
>"this.test='(*this*==password)';
>  
>
>>this.minlength='6';  return this[varName];"));
>>
>>
>>The second problem (but it may be linked to this warning) is that the
>>    
>>
>alert popup indicates :
>  
>
>>Password can not be less than {1} characters. instead of Password can not
>>    
>>
>be less than 6 characters.
>  
>
>><field property="password" depends="required,minlength">
>>                <arg key="user.password"/>
>>                <var>
>>    <var-name>minlength</var-name>
>>    <var-value>6</var-value>
>>   </var>
>>            </field>
>>
>>However all the others validation rules are working well
>>    
>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>  
>


Re: Validation warning under firefox 1.5

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
I don't see any warnings when I try out the struts-examples webapp (latest
1.2.x version) with Firefox 1.5 - in the validator examples the "Javascript
Registration Form" uses minlength on the name fields and it worked with no
problem.

The problem with your error message is that you're not specifying any
replacement "argument" values for the message. It doesn't automatically pick
up the <var> values and use them as argument replacements. You need to have
something like the following....

 <field property="password" depends="required,minlength">
    <arg key="user.password"/>
    <arg name="minlength" key="${var:minlength}" resource="false"
position="1"/>
    <var>
        <var-name>minlength</var-name>
        <var-value>6</var-value>
    </var>
</field>

Niall

----- Original Message ----- 
From: "Xavier Vanderstukken" <xv...@ionicsoft.com>
Sent: Thursday, March 09, 2006 10:05 AM


> The javascript generates by Struts 1.3 to integrate the common-validator
> js produces warnings under ff1.5 :
>
> Avertissement : reference to undefined property this[varName]
>
> this.a0 = new Array("password", "Password can not be less than {1}
characters.",new Function ("varName", "this.minlength='6';  return
this[varName];"));
> this.a1 = new Array("passwordbis", "Password confirmation can not be
lessthan {1} characters.", new Function ("varName",
"this.test='(*this*==password)';
> this.minlength='6';  return this[varName];"));
>
>
> The second problem (but it may be linked to this warning) is that the
alert popup indicates :
>
> Password can not be less than {1} characters. instead of Password can not
be less than 6 characters.
>
>
> <field property="password" depends="required,minlength">
>                 <arg key="user.password"/>
>                 <var>
>     <var-name>minlength</var-name>
>     <var-value>6</var-value>
>    </var>
>             </field>
>
> However all the others validation rules are working well



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org