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]



Reply via email to