If you use the range attribute inline to validate against using the jquery.validate plugin 1.8.1, your validation will probably always fail and receive the message “Please enter a value between NaN and {1}.” or “Please enter a value between {0} and NaN.”.
This drove me nuts for almost a whole day looking for a fix. I finally got smart and looked at the current issues in the Github project. “markusblair” submitted a patch, but that was also incorrect.
To correct this issue, modify the jquery.validate.js file on line 852:
$.each(['rangelength', 'range'], function() { if (rules[this]) { rules[this] = [Number(rules[this][0]), Number(rules[this][1])]; } });
and replace it with:
// Patch by Chris Tierney (CF Webtools 7/13/2011) // Issue logged at https://github.com/jzaefferer/jquery-validation/issues/112 $.each(['rangelength', 'range'], function() { if (typeof rules[this] == 'string') { rules[this] = rules[this].split(","); } if (rules[this]) { rules[this] = [Number(rules[this][0]), Number(rules[this][1])]; } });
Be sure to update your minified version as well and this should solve the range and potentially a similar rangelength method issue immediately.