|
104 | 104 | // Remove possible error style applied by previous validation
|
105 | 105 | $element
|
106 | 106 | .removeClass(config.errorElementClass)
|
107 |
| - .css('border-color', '') |
108 | 107 | .parent()
|
109 | 108 | .find('.'+config.errorMessageClass).remove();
|
110 | 109 |
|
|
119 | 118 |
|
120 | 119 | var validation = $.formUtils.validateInput($element, language, config, $form, eventContext);
|
121 | 120 |
|
| 121 | + console.log(validation); |
| 122 | + |
122 | 123 | if(validation === true) {
|
123 | 124 | $element
|
124 | 125 | .addClass('valid')
|
|
129 | 130 | .removeClass('valid')
|
130 | 131 | .parent()
|
131 | 132 | .removeClass('has-error')
|
132 |
| - .removeClass('has-success'); |
| 133 | + .removeClass('has-success'); |
133 | 134 | } else {
|
134 | 135 | $element
|
135 | 136 | .addClass(config.errorElementClass)
|
|
147 | 148 | $parent.addClass('has-error'); // twitter bs
|
148 | 149 | }
|
149 | 150 |
|
150 |
| - if(config.borderColorOnError !== '') { |
151 |
| - $element.css('border-color', config.borderColorOnError); |
152 |
| - } |
153 |
| - |
154 | 151 | if(attachKeyupEvent) {
|
155 | 152 | $element.bind('keyup', function() {
|
156 | 153 | $(this).validateInputOnBlur(language, config, false, 'keyup');
|
|
272 | 269 | // Reset style and remove error class
|
273 | 270 | //
|
274 | 271 | $form.find('.has-error').removeClass('has-error');
|
275 |
| - $form.find('input,textarea,select') |
276 |
| - .css('border-color', '') |
| 272 | + $form.find('input,textarea,select') |
277 | 273 | .removeClass(config.errorElementClass);
|
278 | 274 |
|
279 | 275 | //
|
|
301 | 297 | $.formUtils.isValidatingEntireForm = false;
|
302 | 298 |
|
303 | 299 | // Apply error style to invalid inputs
|
304 |
| - $.each(errorInputs, function(i, $input) { |
305 |
| - if (config.borderColorOnError !== '') { |
306 |
| - $input.css('border-color', config.borderColorOnError); |
307 |
| - } |
| 300 | + $.each(errorInputs, function(i, $input) { |
308 | 301 | $input
|
309 | 302 | .addClass(config.errorElementClass)
|
310 | 303 | .parent()
|
|
722 | 715 | return config.addValidClassOnAll ? true:null;
|
723 | 716 | }
|
724 | 717 |
|
| 718 | + if( value.trim() === '' && validationRules.indexOf('required') === -1 ) { |
| 719 | + return null; |
| 720 | + } |
| 721 | + |
725 | 722 | $.split(validationRules, function(rule) {
|
726 | 723 | if( rule.indexOf('validate_') !== 0 ) {
|
727 | 724 | rule = 'validate_' + rule;
|
|
803 | 800 | year = findDateUnit('y', formatParts, matches);
|
804 | 801 |
|
805 | 802 | if ((month === 2 && day > 28 && (year % 4 !== 0 || year % 100 === 0 && year % 400 !== 0))
|
806 |
| - || (month === 2 && day > 29 && (year % 4 === 0 || year % 100 !== 0 && year % 400 === 0)) |
807 |
| - || month > 12 || month === 0) { |
| 803 | + || (month === 2 && day > 29 && (year % 4 === 0 || year % 100 !== 0 && year % 400 === 0)) |
| 804 | + || month > 12 || month === 0) { |
808 | 805 | return false;
|
809 | 806 | }
|
810 | 807 | if ((this.isShortMonth(month) && day > 30) || (!this.isShortMonth(month) && day > 31) || day === 0) {
|
|
1374 | 1371 | additionalChars = $el.attr('data-validation-allowing'),
|
1375 | 1372 | pattern = '';
|
1376 | 1373 |
|
1377 |
| - if( additionalChars ) { |
| 1374 | + if( additionalChars) { |
1378 | 1375 | pattern = patternStart + additionalChars + patternEnd;
|
1379 | 1376 | var extra = additionalChars.replace(/\\/g, '');
|
1380 | 1377 | if( extra.indexOf(' ') > -1 ) {
|
|
1386 | 1383 | pattern = patternStart + patternEnd;
|
1387 | 1384 | this.errorMessage = language.badAlphaNumeric;
|
1388 | 1385 | }
|
1389 |
| - |
| 1386 | + |
1390 | 1387 | return new RegExp(pattern).test(val);
|
| 1388 | + |
1391 | 1389 | },
|
1392 | 1390 | errorMessage : '',
|
1393 | 1391 | errorMessageKey: ''
|
|
0 commit comments