commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Duff <david.d...@planetzorbo.co.uk>
Subject Commons Validator problem
Date Wed, 24 Aug 2005 15:43:58 GMT
Hi,

I am trying to specify a min. length for a user name field in my
application.

In my validatior.xml I have specified:

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

In my validator-rules.xml I have:

<validator
        name="minlength"               
classname="com.company.product.controller.validator.CustomValidator"
        method="validateMinLength"
        methodParams="java.lang.Object,
                      org.apache.commons.validator.Field"       
        msg="errors.min"/>

In my custom validator I have my validateMinLength() method.

I would expect the two arguments (user.username and minlength) to get
picked up but it only picks up the first argument even though ||I can
see the two args in the field object||.  When I remove the name
attribute from arg, it will then pick up the second argument but look
for the key in the resource even although resource is set to false.

I am using commons-validator-1.1.4.jar|

Can anyone tell me what I'm doing wrong?

Thanks in advance.
David

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


Mime
View raw message