Skip to content

Commit a66bbe9

Browse files
committed
Added mehod $.fn.validate , issue victorjonsson#280
1 parent cf2e9e1 commit a66bbe9

19 files changed

+53
-22
lines changed

form-validator/brazil.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
* @website http://formvalidator.net/#brazil-validators
1313
* @license Dual licensed under the MIT or GPL Version 2 licenses
14-
* @version 2.2.60
14+
* @version 2.2.61
1515
*/
1616

1717
$.formUtils.addValidator({

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.2.60
13+
* @version 2.2.61
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/#file-validators
1212
* @license Dual licensed under the MIT or GPL Version 2 licenses
13-
* @version 2.2.60
13+
* @version 2.2.61
1414
*/
1515
(function($, window) {
1616

form-validator/html5.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*
1818
* @website http://formvalidator.net/
1919
* @license Dual licensed under the MIT or GPL Version 2 licenses
20-
* @version 2.2.60
20+
* @version 2.2.61
2121
*/
2222
(function($, window) {
2323

form-validator/jquery.form-validator.js

Lines changed: 33 additions & 2 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.2.60
8+
* @version 2.2.61
99
*/
1010
(function ($) {
1111

@@ -116,6 +116,7 @@
116116
$form.children().eq(0).before(container);
117117
};
118118

119+
119120
/**
120121
* Assigns validateInputOnBlur function to elements blur event
121122
*
@@ -216,6 +217,36 @@
216217
return this;
217218
};
218219

220+
/**
221+
* @param {Function} cb
222+
* @param {Object} [conf]
223+
* @param {Object} [lang]
224+
*/
225+
$.fn.validate = function(cb, conf, lang) {
226+
var language = $.extend({}, $.formUtils.LANG, lang || {});
227+
this.each(function() {
228+
var $elem = $(this);
229+
$elem.one('validation', function(evt, isValid) {
230+
cb(isValid, this, evt);
231+
});
232+
$elem.validateInputOnBlur(
233+
language,
234+
$.extend({}, $elem.closest('form').get(0).validationConfig, conf || {})
235+
);
236+
});
237+
};
238+
239+
/**
240+
* Tells whether or not validation of this input will have to postpone the form submit ()
241+
* @returns {Boolean}
242+
*/
243+
$.fn.willPostponeValidation = function() {
244+
return (this.valAttr('suggestion-nr') ||
245+
this.valAttr('postpone') ||
246+
this.hasClass('hasDatepicker'))
247+
&& !window.postponedValidation;
248+
};
249+
219250
/**
220251
* Validate single input when it loses focus
221252
* shows error message in a span element
@@ -231,7 +262,7 @@
231262

232263
$.formUtils.eventType = eventType;
233264

234-
if ((this.valAttr('suggestion-nr') || this.valAttr('postpone') || this.hasClass('hasDatepicker')) && !window.postponedValidation) {
265+
if ( this.willPostponeValidation() ) {
235266
// This validation has to be postponed
236267
var _self = this,
237268
postponeTime = this.valAttr('postpone') || 200;

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

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

form-validator/jsconf.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* @website http://formvalidator.net/#location-validators
99
* @license Dual licensed under the MIT or GPL Version 2 licenses
10-
* @version 2.2.60
10+
* @version 2.2.61
1111
*/
1212
(function($) {
1313

form-validator/lang/de.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* @website http://formvalidator.net/
88
* @license Dual licensed under the MIT or GPL Version 2 licenses
9-
* @version 2.2.60
9+
* @version 2.2.61
1010
*/
1111
(function($, window) {
1212

form-validator/lang/es.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* @website http://formvalidator.net/
88
* @license Dual licensed under the MIT or GPL Version 2 licenses
9-
* @version 2.2.60
9+
* @version 2.2.61
1010
*/
1111
(function($, window) {
1212

form-validator/lang/fr.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* @website http://formvalidator.net/
88
* @license Dual licensed under the MIT or GPL Version 2 licenses
9-
* @version 2.2.60
9+
* @version 2.2.61
1010
*/
1111
(function($, window) {
1212

form-validator/lang/pt.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* @website http://formvalidator.net/
88
* @license Dual licensed under the MIT or GPL Version 2 licenses
9-
* @version 2.2.60
9+
* @version 2.2.61
1010
*/
1111
(function($, window) {
1212

form-validator/lang/sv.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* @website http://formvalidator.net/
88
* @license Dual licensed under the MIT or GPL Version 2 licenses
9-
* @version 2.2.60
9+
* @version 2.2.61
1010
*/
1111
(function($, window) {
1212

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.2.60
13+
* @version 2.2.61
1414
*/
1515
(function($) {
1616

form-validator/sanitize.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*
2323
* @website http://formvalidator.net/
2424
* @license Dual licensed under the MIT or GPL Version 2 licenses
25-
* @version 2.2.60
25+
* @version 2.2.61
2626
*/
2727
(function($, window) {
2828

form-validator/security.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* - cvv
1414
*
1515
* @website http://formvalidator.net/#security-validators
16-
* @version 2.2.60
16+
* @version 2.2.61
1717
*/
1818
(function($, window) {
1919

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.2.60
16+
* @version 2.2.61
1717
*/
1818
(function($, window) {
1919

form-validator/theme-default.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

form-validator/toggleDisabled.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
* @website http://formvalidator.net/
1010
* @license Dual licensed under the MIT or GPL Version 2 licenses
11-
* @version 2.2.60
11+
* @version 2.2.61
1212
*/
1313
(function($, window, undefined) {
1414

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.2.60
12+
* @version 2.2.61
1313
*/
1414
$.formUtils.addValidator({
1515
name : 'ukvatnumber',

0 commit comments

Comments
 (0)