struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From R Balaji <bala...@india.adventnet.com>
Subject Validator Problem when using "Required"
Date Thu, 24 Jul 2003 05:50:09 GMT
Hi,

I am using Struts Validator for validating my Application. i am using 
"required"  for many of the fields and using minlength and maxlength for 
the userName field.

my validation.xml reads like this,

/Ex :

  <field  property="lastName" depends="*required*">
      <arg0 key="validateform.lastname"/>
  </field>

  <field  property="userName"
    depends="*required,minlength,maxlength*">
      <arg0 key="validateform.userName" name="required"/>
 <arg0 key="validateform.userName" name="minlength"/>
<arg1   key="${var:minlength}" name="minlength" resource="false"/>

 <arg0 key="validateform.userName" name="maxlength"/>
<arg1   key="${var:maxlength}" name="maxlength" resource="false"/>
    <var>
<var-name>minlength</var-name>
<var-value>5</var-value>
</var>
    <var>
<var-name>maxlength</var-name>
<var-value>10</var-value>
</var>
  </field>

  <field  property="age"
    depends="*required*">
      <arg0 key="validateform.age"/>
  </field>/

If i fail to give the userName it is prompting, that userName is 
required. But if i input only "2" characters for the userName, while all 
other ( some of the other ) fields are empty it prompts only about all 
other required fields, and not validating the *minlength* condition 
until all other required conditions get satisfied. I feel it should also 
validate the userName and prompt that the length is less than 5 chatacters.

is there anything to define the precedence in the validation.xml ? .. 
will the minlength be validated only if all the required get satisfied. ??

please Help me.

TIA,

Balaji


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