An update for the jQuery validation plugin is available. Among various bugfixes there are two new localizations (Taiwan and Kazakhstan), an enhancement to $.validator.addMethod that allows you to specify (localized) messages first, the actual method later; the submitHandler-option now keeps a submit-button “alive”, that is, won’t get lost when using the option.
Probably most notable: The remote method now allows you to specify custom messages! Return JSON “true” for a valid field, false/null/undefined for an invalid field and the default message, or any other value to use as the message.
The full changelog:
- Fixed a bug related to the wrapper-option, where all ancestor-elements that matched the wrapper-option where selected (http://plugins.jquery.com/node/7624)
- Updated multipart demo to use latest jQuery UI accordion
- Added dateNL and time methods to additionalMethods.js
- Added Traditional Chinese (Taiwan, tw) and Kazakhstan (KK) localization
- Moved jQuery.format (fomerly String.format) to jQuery.validator.format, jQuery.format is deprecated and will be removed in 1.6 (see http://code.google.com/p/jquery-utils/issues/detail?id=15 for details)
- Cleaned up messages_pl.js and messages_ptbr.js (still defined messages for max/min/rangeValue, which were removed in 1.4)
- Fixed flawed boolean logic in valid-plugin-method for multiple elements; now all elements need to be valid for a boolean-true result (http://plugins.jquery.com/node/8481)
- Enhancement $.validator.addMethod: An undefined third message-argument won’t overwrite an existing message (http://plugins.jquery.com/node/8443)
- Enhancement to submitHandler option: When used, click events on submit buttons are captured and the submitting button is inserted into the form before calling submitHandler, and removed afterwards; keeps submit buttons intact (http://plugins.jquery.com/node/7183)
- Added option validClass, default “valid”, which adds that class to all valid elements, after validation (http://dev.jquery.com/ticket/2205)
- Added creditcardtypes method to additionalMethods.js, including tests (via http://dev.jquery.com/ticket/3635)
- Improved remote method to allow serverside message as a string, or true for valid, or false for invalid using the clientside defined message (http://dev.jquery.com/ticket/3807)
- Improved accept method to also accept a Drupal-style comma-seperated list of values (http://plugins.jquery.com/node/8580)
As usual, support is available via:
- Please post questions to the jQuery discussion list, putting “(validate)” into the subject of your post, making it easier to spot it and respond quickly. 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 plugins.jQuery.com bug tracker (requires registration).
Just uploaded a hotfix 1.5.4 release, with a fix for the remote method.
Uploaded another release, now at 1.5.5, hopefully the final fix for the remote method: http://plugins.jquery.com/node/8659