|
86 | 86 | var config = {
|
87 | 87 | validationRuleAttribute : 'data-validation',
|
88 | 88 | errorElementClass : 'error', // Class that will be put on elements which value is invalid
|
89 |
| - borderColorOnError : 'red', |
90 | 89 | dateFormat : 'yyyy-mm-dd'
|
91 | 90 | };
|
92 | 91 |
|
|
99 | 98 | language = jQueryFormUtils.LANG;
|
100 | 99 | }
|
101 | 100 |
|
102 |
| - var elementType = $element.attr('type'); |
103 |
| - if (jQueryFormUtils.defaultBorderColor === null && elementType !== 'submit' && elementType !== 'checkbox' && elementType !== 'radio') { |
104 |
| - jQueryFormUtils.defaultBorderColor = $element.css('border-color'); |
105 |
| - } |
106 |
| - |
107 | 101 | // Remove possible error style applied by previous validation
|
108 | 102 | $element
|
109 | 103 | .removeClass(config.errorElementClass)
|
110 | 104 | .parent()
|
111 | 105 | .find('.jquery_form_error_message').remove();
|
112 |
| - |
113 |
| - if(config.borderColorOnError !== '') { |
114 |
| - $element.css('border-color', jQueryFormUtils.defaultBorderColor); |
115 |
| - } |
116 | 106 |
|
117 | 107 | var validation = jQueryFormUtils.validateInput($element, language, config);
|
118 | 108 |
|
|
124 | 114 | .parent()
|
125 | 115 | .append('<span class="jquery_form_error_message">'+validation+'</span>');
|
126 | 116 |
|
127 |
| - if(config.borderColorOnError !== '') { |
128 |
| - $element.css('border-color', config.borderColorOnError); |
129 |
| - } |
130 |
| - |
131 | 117 | if(attachKeyupEvent) {
|
132 | 118 | $element.bind('keyup', function() {
|
133 | 119 | $(this).doValidate(language, settings, false);
|
|
152 | 138 | var config = {
|
153 | 139 | ignore : [], // Names of inputs not to be validated even though node attribute containing the validation rules tells us to
|
154 | 140 | errorElementClass : 'error', // Class that will be put on elements which value is invalid
|
155 |
| - borderColorOnError : 'red', // Border color of elements which value is invalid, empty string to not change border color |
156 | 141 | errorMessageClass : 'jquery_form_error_message', // class name of div containing error messages when validation fails
|
157 | 142 | validationRuleAttribute : 'data-validation', // name of the attribute holding the validation rules
|
158 | 143 | errorMessagePosition : 'top', // Can be either "top" or "element"
|
|
240 | 225 | $form.find('input,textarea,select').each(function() {
|
241 | 226 | if (!ignoreInput($(this).attr('name'), $(this).attr('type'))) {
|
242 | 227 |
|
243 |
| - // memorize border color |
244 |
| - if (jQueryFormUtils.defaultBorderColor === null && $(this).attr('type')) { |
245 |
| - jQueryFormUtils.defaultBorderColor = $(this).css('border-color'); |
246 |
| - } |
247 |
| - |
248 | 228 | var valid = jQueryFormUtils.validateInput(
|
249 | 229 | $(this),
|
250 | 230 | language,
|
|
263 | 243 | //
|
264 | 244 | // Reset style and remove error class
|
265 | 245 | //
|
266 |
| - $form.find('input,textarea,select') |
267 |
| - .css('border-color', jQueryFormUtils.defaultBorderColor) |
268 |
| - .removeClass(config.errorElementClass); |
| 246 | + $form.find('input,textarea,select').removeClass(config.errorElementClass); |
269 | 247 |
|
270 | 248 |
|
271 | 249 | //
|
|
282 | 260 |
|
283 | 261 | // Apply error style to invalid inputs
|
284 | 262 | for (var i = 0; i < errorInputs.length; i++) {
|
285 |
| - if (config.borderColorOnError !== '') { |
286 |
| - errorInputs[i].css('border-color', config.borderColorOnError); |
287 |
| - } |
288 | 263 | errorInputs[i].addClass(config.errorElementClass);
|
289 | 264 | }
|
290 | 265 |
|
|
336 | 311 | */
|
337 | 312 | var jQueryFormUtils = {};
|
338 | 313 |
|
339 |
| -/** |
340 |
| - * Static variable for holding default border color on input |
341 |
| - */ |
342 |
| -jQueryFormUtils.defaultBorderColor = null; |
343 |
| - |
344 | 314 | /**
|
345 | 315 | * Validate email
|
346 | 316 | *
|
|
0 commit comments