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

Don't work with input(type="hidden", required="required") #95

Closed SilentImp closed 9 years ago

SilentImp commented 9 years ago

h5Validate ignore hidden inputs :(

ericelliott commented 9 years ago

Yes it does ignore hidden inputs. This is not a bug. As per the HTML5 constraint validation spec:

"Constraint validation: If an input element's type attribute is in the Hidden state, it is barred from constraint validation." -

You should not block the form submission based on inputs that the user can't edit.

If there is something the user can do to correct the values in the hidden inputs, you should attach validation logic to the visible inputs, instead.