jquery-archive / plugins.jquery.com

The jQuery Plugins site
plugins.jquery.com
Other
1.24k stars 243 forks source link

Jquery Validation range method bug #128

Closed martonl closed 11 years ago

martonl commented 11 years ago

Hi All,

I found a bug in Jquery Validation 1.11 Range validation method. This line is buggy:

return this.optional(element) || ( value >= param[0] && value <= param[1] );

Because this line checks strings, not numbers. If I have a range between 30 and 200, and I want to validate 120, then the string 120 is lesser then string 30.

This line must be something like this:

return this.optional(element) || ( Number(value) >= Number(param[0]) && Number(value) <= Number(param[1]) );

gnarf commented 11 years ago

Is this a bug report for a plugin? Go file it on the plugin... Wait, I see you already have... https://github.com/jzaefferer/jquery-validation/issues/626#issuecomment-13339617

martonl commented 11 years ago

yes, after this issue, I found better place for it. Sorry!