commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niall Pemberton" <niall.pember...@gmail.com>
Subject Re: [validator] javascript integer validation quirk
Date Fri, 09 Jun 2006 17:42:24 GMT
On 6/9/06, Jacob Kjome <hoju@visi.com> wrote:

> I'm using commons-validator 1.1.4 with Struts 1.2.7.  I'm try to validate using
> the "integer" validation and I'm running into a problem, but only on the
> client-side.  If I enter the following, the javascript integer validation will
> report the number as an invalid integer...
>
> 012345678
>
> Note the leading zero.  If I change that zero to any other number, javascript
> integer validation passes.  If I disable javascript validation, the server-side
> integer validation sees the number above as a valid Integer.  Note that
> technically, what I need is a more generic "numeric" validation.  The leading
> zero is significant.  I just need to make sure that everything entered is
> numeric.  I store it in the form as a String.  I have certain size
> restrictions, but that is irrelevant to this discussion.  For the purpose here,
> I don't care if the number fits within a Java Integer, Long, etc.  It could be 1
> numeric character or a hundred.  I just want them to be all numeric.  Is there a
> validator for this?
>
> Anyway, is this a known bug?  I looked in both Bugzilla and Jira and didn't see
> anything pertaining to this issue.  Is a fix in a later release of
> commons-validator?  If so, is it possible to use later releases of
> commons-validator with Struts-1.2.7, or would I have to upgrade to a later
> release of Struts to be compatible with later releases of commons-validator?


Yes this was fixed in Validator 1.2.0:

http://issues.apache.org/jira/browse/VALIDATOR-59

The latest version of Validator is 1.3.0 - it is compatible with
Struts 1.2.9, but I haven't tried it with Struts 1.2.7 and can't off
the top of my head remember if there were any compatibility changes
(some validator bugs were fixed in 1.2.8). Both Struts 1.2.8 and 1.2.9
were primarily fixes for security issues, so it would probably be a
good idea to upgrade your version of Struts anyway.

Below are details of Struts and Validator versions and upgrade notes for Struts

http://jakarta.apache.org/commons/validator/changes-report.html
http://wiki.apache.org/jakarta-commons/ValidatorVersion120

http://struts.apache.org/struts-doc-1.2.9/userGuide/release-notes.html
http://struts.apache.org/struts-doc-1.2.9/userGuide/release-notes-1.2.8.html
http://wiki.apache.org/struts/StrutsUpgrade

Niall

> thanks,
>
> Jake

---------------------------------------------------------------------
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