ericelliott / h5Validate

An HTML5 form validation plugin for jQuery. Works on all major browsers, both new and old. Implements inline, realtime validation best practices (based on surveys and usability studies). Developed for production use in e-commerce. Currently in production with millions of users.
576 stars 125 forks source link

Maxlength -1 in FF 16.0.2 #56

Closed mbirth closed 11 years ago

mbirth commented 11 years ago

FF reports maxlength as -1 if not set, so h5Validate always reports "tooLong" in lines 279-282 , even with the field empty.

To fix this, I changed the if to:

                if (!isNaN(maxlength) && maxlength >= 0 && value.length > maxlength) {
ericelliott commented 11 years ago

Good catch! Can you add a test for this and submit a pull request?

ericelliott commented 11 years ago

I took a closer look at this. Checked FF on Mac an Windows, and was unable to reproduce the issue. Also - an empty maxlength is not a valid value, anyway.