You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Marco Tedone <mt...@jemos.org> on 2003/06/08 12:03:00 UTC

Question about maxlength with Validator

Hi, now that I got Validator working properly, I'm trying to declare a
validation by which an edited field cannot be greater than a certain size,
but it doesn't work.

Here follows what I've done:

In the struts-config.xml file, i declared among the others, a  password
property in the DynaValidatorForm with the size attribute set to 10

<form-property name="password" type="java.lang.String" size="10" />

In the validation.xml file, I declared the validation for my field as
follows:

<field property="password" depends="required,maxlength">
<arg0 key="error.required.password"/>
</field>

I thought that maxlength would rely on the 'size' attribute declared in the
struts-config.xml file.

I obtain a message like the following when Validator performs the
validation:

* Password can not be greater than null characters.

What am I doing wrong?

Thanks,

Marco




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


RE: Question about maxlength with Validator

Posted by John Devine <jo...@comcast.net>.
I just went through the same problem last night.

Here's how I solved it:

   <form name="logmein" >
    <field property="userName"
     depends="required,minlength">
    <arg0 key="logon.userName.displayName" />
    <arg1 name="minlength" key="${var:minlength}" resource="false" />
    <var>
     <var-name>minlength</var-name>
     <var-value>4</var-value>
    </var>
    </field>
    <field property="password"
     depends="required,minlength">
    <arg0 key="logon.password.displayName" />
    <arg1 name="minlength" key="${var:minlength}" resource="false" />
    <var>
     <var-name>minlength</var-name>
     <var-value>6</var-value>
    </var>
    </field>
   </form>

-----Original Message-----
From: Marco Tedone [mailto:mtedone@jemos.org] 
Sent: Sunday, June 08, 2003 5:03 AM
To: Struts-user-list
Subject: Question about maxlength with Validator

Hi, now that I got Validator working properly, I'm trying to declare a
validation by which an edited field cannot be greater than a certain
size,
but it doesn't work.

Here follows what I've done:

In the struts-config.xml file, i declared among the others, a  password
property in the DynaValidatorForm with the size attribute set to 10

<form-property name="password" type="java.lang.String" size="10" />

In the validation.xml file, I declared the validation for my field as
follows:

<field property="password" depends="required,maxlength">
<arg0 key="error.required.password"/>
</field>

I thought that maxlength would rely on the 'size' attribute declared in
the
struts-config.xml file.

I obtain a message like the following when Validator performs the
validation:

* Password can not be greater than null characters.

What am I doing wrong?

Thanks,

Marco




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


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