When using Drupal's integer field with a maximum value set, the values are compared as strings instead of numbers. The JS inserted into the head tag has the maximum values quoted.

I've been able to workaround this by updating the local jquery.validate.js file as follows:

--- a/jquery.validate/dist/jquery.validate.js
+++ b/jquery.validate.orig/dist/jquery.validate.js
@@ -1226,7 +1226,7 @@ $.extend( $.validator, {
 
                // http://jqueryvalidation.org/max-method/
                max: function( value, element, param ) {
-                       return this.optional( element ) || Number(value) <= Number(param);
+                       return this.optional( element ) || value <= param;
                },
 
                // http://jqueryvalidation.org/range-method/

It would seem to work without this modification if the values sent to the jQuery Validations max method were not quoted.

Comments

Jelle_S’s picture

Status: Active » Fixed

Fixed in latest dev.

  • Jelle_S committed 33b4d9a on 7.x-2.x
    Issue #2475573: Numbers for .max method are compared as strings
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.