use mask instead of integer. That should do the job. Error message states, that the entry is invalid. BTW, arg1 has to be used both for minlength and maxlength since {1} is the argument in the error message.
I found that mask can solve nearly all validation problems if they are constrained to one field. If you have interdependent fields you still have to go back and implement ActionForm::validate.
<field property="dayPhone3" depends="required,mask,minlength,maxlength">
<arg0 key="Daytime Phone box 3" resource="false"/>
<arg1 name="minlength" key="${var:minlength}" resource="false" />
<arg1 name="maxlength" key="${var:maxlength}" resource="false" />
<var>
<var-name>mask</var-name>
<var-value>^[0-9]*$</var-value>
</var>
<var>
<var-name>minlength</var-name>
<var-value>4</var-value>
</var>
<var>
<var-name>maxlength</var-name>
<var-value>4</var-value>
</var>
</field>Markus
Brad Plies wrote:
Hi folks,
Using struts-RC2, when using Validator with a dependency on "integer" validation, I have a problem with the validator assuming that any integer starting with zero "0" is necessarily octal. In one example, I have a form where people enter phone numbers. Which is split up into 3 text boxes. Area code, 3 digits, last 4 digits. A fairly common way to break it up.
Here is the validation.xml entry for one such field:
<field property="dayPhone3" depends="required, integer, minlength, maxlength"> <arg0 key="Daytime Phone box 3" resource="false"/> <arg1 name="minlength" key="${var:minlength}" resource="false"/> <arg2 name="maxlength" key="${var:maxlength}" resource="false"/> <var> <var-name>maxlength</var-name> <var-value>4</var-value> </var> <var> <var-name>minlength</var-name> <var-value>4</var-value> </var> </field>
Numbers like "0897" will cause the "... must be an integer" message. Obviously it is not a valid octal number, and I know that the format of these numbers would appear as an attempt at an octal number.
How do you prevent octal interpretation but still ensure that the field is numeric? I'm being a tad lazy here, because I know I could always write my own pluggable validator, but I'd like to use what already exists if possible.
--------------------------------------------------------------------- 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]

