Skip to content

Commit fa4e146

Browse files
committed
Now possible to use callback in errorMessagePosition, issue victorjonsson#226
1 parent b9d8a67 commit fa4e146

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+72
-57
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 MIT
14-
* @version 2.2.87
14+
* @version 2.2.88
1515
*/
1616

1717
$.formUtils.addValidator({

form-validator/brazil.js

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/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 MIT
13-
* @version 2.2.87
13+
* @version 2.2.88
1414
*/
1515
(function($) {
1616

form-validator/date.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
*
44
* @website by
55
* @license MIT
6-
* @version 2.2.87
6+
* @version 2.2.88
77
*/
88
!function(a){a.formUtils.addValidator({name:"time",validatorFunction:function(a){if(null===a.match(/^(\d{2}):(\d{2})$/))return!1;var b=parseInt(a.split(":")[0],10),c=parseInt(a.split(":")[1],10);return b>23||c>59?!1:!0},errorMessage:"",errorMessageKey:"badTime"}),a.formUtils.addValidator({name:"birthdate",validatorFunction:function(b,c,d){var e="yyyy-mm-dd";c.valAttr("format")?e=c.valAttr("format"):"undefined"!=typeof d.dateFormat&&(e=d.dateFormat);var f=a.formUtils.parseDate(b,e);if(!f)return!1;var g=new Date,h=g.getFullYear(),i=f[0],j=f[1],k=f[2];if(i===h){var l=g.getMonth()+1;if(j===l){var m=g.getDate();return m>=k}return l>j}return h>i&&i>h-124},errorMessage:"",errorMessageKey:"badDate"})}(jQuery);

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 MIT
13-
* @version 2.2.87
13+
* @version 2.2.88
1414
*/
1515
(function($, window) {
1616

form-validator/file.js

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/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 MIT
20-
* @version 2.2.87
20+
* @version 2.2.88
2121
*/
2222
(function($, window) {
2323

form-validator/html5.js

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/jquery.form-validator.js

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* @website http://formvalidator.net/
77
* @license MIT
8-
* @version 2.2.87
8+
* @version 2.2.88
99
*/
1010
(function ($) {
1111

@@ -66,9 +66,13 @@
6666
$mess = {};
6767

6868
if (custom) {
69-
setErrorMessage($(custom));
69+
_warn('Using deprecated element reference '+custom.id);
70+
$messageContainer = $(custom);
71+
} else if( typeof $messageContainer === 'function' ) {
72+
$messageContainer = $messageContainer($input, mess, conf);
7073
}
71-
else if (typeof $messageContainer === 'object') {
74+
75+
if (typeof $messageContainer === 'object') {
7276
var $found = false;
7377
$messageContainer.find('.' + conf.errorMessageClass).each(function () {
7478
if (this.inputReferer === $input[0]) {
@@ -101,6 +105,17 @@
101105
setErrorMessage($mess);
102106
}
103107
},
108+
_warn = function(msg) {
109+
if( 'console' in window ) {
110+
if( typeof window.console.warn === 'function' ) {
111+
window.console.warn(msg);
112+
} else if( typeof window.console.log === 'function' ) {
113+
window.console.log(msg);
114+
}
115+
} else {
116+
alert(msg);
117+
}
118+
},
104119
_templateMessage = function ($form, title, errorMessages, conf) {
105120
var messages = conf.errorMessageTemplate.messages.replace(/\{errorTitle\}/g, title),
106121
fields = [],
@@ -490,6 +505,7 @@
490505
}
491506
// Customize display message
492507
else if (conf.errorMessagePosition === 'custom') {
508+
_warn('Use deprecated function errorMessageCustom');
493509
if (typeof conf.errorMessageCustom === 'function') {
494510
conf.errorMessageCustom($form, language.errorTitle, errorMessages, conf);
495511
}
@@ -522,9 +538,7 @@
522538
* @param conf
523539
*/
524540
$.fn.validateForm = function (language, conf) {
525-
if (window.console && typeof window.console.warn === 'function') {
526-
window.console.warn('Use of deprecated function $.validateForm, use $.isValid instead');
527-
}
541+
_warn('Use of deprecated function $.validateForm, use $.isValid instead');
528542
return this.isValid(language, conf, true);
529543
};
530544

@@ -877,9 +891,7 @@
877891
script.onload = moduleLoadedCallback;
878892
script.src = scriptUrl + ( scriptUrl.slice(-7) === '.dev.js' ? cacheSuffix : '' );
879893
script.onerror = function() {
880-
if( 'console' in window && window.console.log ) {
881-
window.console.log('Unable to load form validation module '+scriptUrl);
882-
}
894+
_warn('Unable to load form validation module '+scriptUrl);
883895
};
884896
script.onreadystatechange = function () {
885897
// IE 7 fix

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/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 MIT
10-
* @version 2.2.87
10+
* @version 2.2.88
1111
*/
1212
(function($) {
1313

form-validator/jsconf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
*
44
* @website by
55
* @license MIT
6-
* @version 2.2.87
6+
* @version 2.2.88
77
*/
88
!function(a){"use strict";a.setupValidation=function(b){var c=a(b.form||"form");a.each(b.validate||b.validation||{},function(b,d){var e;e="#"===b[0]?a(b):c.find("."===b[0]?b:'*[name="'+b+'"]'),e.attr("data-validation",d.validation),a.each(d,function(a,b){"validation"!==a&&b!==!1&&(b===!0&&(b="true"),e.valAttr(a,b))})}),a.validate(b)}}(jQuery);

form-validator/lang/cz.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 MIT
9-
* @version 2.2.87
9+
* @version 2.2.88
1010
*/
1111
(function($, window) {
1212

form-validator/lang/cz.js

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/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 MIT
9-
* @version 2.2.87
9+
* @version 2.2.88
1010
*/
1111
(function($, window) {
1212

form-validator/lang/de.js

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/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.87
9+
* @version 2.2.88
1010
*/
1111
(function($, window) {
1212

0 commit comments

Comments
 (0)