Release: Validation Plugin 1.9.0

An update for the jQuery validation plugin is available. Most notable is heavily improved compability with HTML5 controls: You can apply validation rules to input types like number, email or url, it’ll get picked up by the plugin if the type matches a rule, and a required attribute (with the argument) also works with both jQuery 1.6+ (prop) and previous versions (attr).

Another change should make the setup of forms with hidden elements easier, these are now ignored by default (option “ignore” has “:hidden” now as default). In theory, this could break an existing setup. In the unlikely case that it actually does, you can fix it by setting the ignore-option to “[]” (square brackets without the quotes).

A few improvements and bug fixes for validation methods landed:

  • Creditcard now accepts spaces between the other valid characters
  • Email doesn’t accept a dot character at the end anymore.
  • The time method (in additionalMethods.js) is now more thorough.
  • A time12h method got added (also in additionalMethods.js), to validate 12-hour times, while the existing time method does 24-hour times.

There also two new localizations, resulting in a total number of 38 localizations. Existing localizations saw various improvements – thanks to everyone who contributed those! Its the only feature where I’m relying completely on contributions, as I can’t verify the correctness of any of the localizations (other then English and German).

Backwards compatibility is still going strong: The plugin should work with anything from jQuery 1.3.x to 1.6.x.

Download this release.

The full changelog:

  • Added Basque (EU) localization
  • Added Slovenian (SL) localization
  • Fixed issue #127 – Finnish translations has one : instead of ;
  • Fixed Russian localization, minor syntax issue
  • Added in support for HTML5 input types, fixes #97
  • Improved HTML5 support by setting novalidate attribute on the form, and reading the type attribute.
  • Fixed showLabel() removing all classes from error element. Remove only settings.validClass. Fixes #151.
  • Added ‘pattern’ to additional-methods to validate against arbitraty regular expressions.
  • Improved email method to not allow the dot at the end (valid by RFC, but unwanted here). Fixes #143
  • Fixed swedish and norwedian translations, min/max messages got switched. Fixes #181
  • Fixed #184 – resetForm: should unset lastElement
  • Fixed #71 – improve existing time method and add time12h method for 12h am/pm time format
  • Fixed #177 – Fix validation of a single radio or checkbox input
  • Fixed #189 – :hidden elements are now ignored by default
  • Fixed #194 – Required as attribute fails if jQuery>=1.6 – Use .prop instead of .attr
  • Fixed #47, #39, #32 – Allowed credit card numbers to contain spaces as well as dashes (spaces are commonly input by users).
As usual:
  • Please post questions to the official Using jQuery Plugins Forum, tagging your question with (at least) “validate”. Keep your question short and succinct and provide code when possible; a testpage makes it much more likely that you get an useful answer in no time.
  • Please post bug reports and other contributions (enhancements, features, eg. new validation methods) to the GitHub issue tracker

Enjoy!

-Jörn

No more comments.
  1. jiles

    Jorn, great update! Was hoping you’d come along with some html5 support and got lucky to come across this today. Only issue I had was in the pattern validator: had to change c.test(a) to new RegExp(c).test(a). Maybe I’m using the pattern’s wrong (first shot at this), but with that small tweak it seems to be working perfectly. Thanks for the great work!