Skip to content

Commit 8b082bf

Browse files
committed
now possible to return an array with errors from onVAlidate, issue victorjonsson#87
1 parent e2f428b commit 8b082bf

File tree

9 files changed

+18
-12
lines changed

9 files changed

+18
-12
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ it calls jQ func **$.formUtils.validateInput** to validate the single input when
298298
* Incorrect error-styling when using datepicker or suggestions is now fixed
299299
* Incorrect error-styling of select elements is now fixed
300300
* Deprecated function $.validationSetup is now removed, use $.validate() instead
301+
* You can now return an array with errors using the event `onValidate`
301302

302303
#### 2.1.36
303304
* Now possible to use the native reset() function to clear error messages and error styling of the input elements

form-validator/date.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* @website http://formvalidator.net/#location-validators
1212
* @license Dual licensed under the MIT or GPL Version 2 licenses
13-
* @version 2.1.44
13+
* @version 2.1.45
1414
*/
1515
(function($) {
1616

form-validator/file.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* @website http://formvalidator.net/
1212
* @license Dual licensed under the MIT or GPL Version 2 licenses
13-
* @version 2.1.44
13+
* @version 2.1.45
1414
*/
1515
(function($, window) {
1616

form-validator/jquery.form-validator.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* @website http://formvalidator.net/
77
* @license Dual licensed under the MIT or GPL Version 2 licenses
8-
* @version 2.1.44
8+
* @version 2.1.45
99
*/
1010
(function($) {
1111

@@ -328,9 +328,14 @@
328328

329329
// Run validation callback
330330
if( typeof conf.onValidate == 'function' ) {
331-
var resp = conf.onValidate($form);
332-
if( resp && resp.element && resp.message ) {
333-
addErrorMessage(resp.message, resp.element);
331+
var errors = conf.onValidate($form);
332+
if($.isArray(errors) ) {
333+
$.each(errors, function(i, err) {
334+
addErrorMessage(err.message, err.element);
335+
});
336+
}
337+
else if( errors && errors.element && errors.message ) {
338+
addErrorMessage(errors.message, errors.element);
334339
}
335340
}
336341

form-validator/jquery.form-validator.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

form-validator/location.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* @website http://formvalidator.net/#location-validators
1212
* @license Dual licensed under the MIT or GPL Version 2 licenses
13-
* @version 2.1.44
13+
* @version 2.1.45
1414
*/
1515
(function($) {
1616

form-validator/security.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
* @website http://formvalidator.net/#security-validators
1414
* @license Dual licensed under the MIT or GPL Version 2 licenses
15-
* @version 2.1.44
15+
* @version 2.1.45
1616
*/
1717
(function($) {
1818

form-validator/sweden.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
* @website http://formvalidator.net/#swedish-validators
1515
* @license Dual licensed under the MIT or GPL Version 2 licenses
16-
* @version 2.1.44
16+
* @version 2.1.45
1717
*/
1818
(function($, window) {
1919

form-validator/uk.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
* @website http://formvalidator.net/#uk-validators
1111
* @license Dual licensed under the MIT or GPL Version 2 licenses
12-
* @version 2.1.44
12+
* @version 2.1.45
1313
*/
1414
$.formUtils.addValidator({
1515
name : 'ukvatnumber',

0 commit comments

Comments
 (0)