Skip to content

Commit 561761c

Browse files
author
Matt Clements
committed
Changes to remove .css('border-color' manually set in Javascript
1 parent 1c7a99d commit 561761c

File tree

3 files changed

+6
-32
lines changed

3 files changed

+6
-32
lines changed

jquery.formvalidator.js

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@
8686
var config = {
8787
validationRuleAttribute : 'data-validation',
8888
errorElementClass : 'error', // Class that will be put on elements which value is invalid
89-
borderColorOnError : 'red',
9089
dateFormat : 'yyyy-mm-dd'
9190
};
9291

@@ -99,20 +98,11 @@
9998
language = jQueryFormUtils.LANG;
10099
}
101100

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-
107101
// Remove possible error style applied by previous validation
108102
$element
109103
.removeClass(config.errorElementClass)
110104
.parent()
111105
.find('.jquery_form_error_message').remove();
112-
113-
if(config.borderColorOnError !== '') {
114-
$element.css('border-color', jQueryFormUtils.defaultBorderColor);
115-
}
116106

117107
var validation = jQueryFormUtils.validateInput($element, language, config);
118108

@@ -124,10 +114,6 @@
124114
.parent()
125115
.append('<span class="jquery_form_error_message">'+validation+'</span>');
126116

127-
if(config.borderColorOnError !== '') {
128-
$element.css('border-color', config.borderColorOnError);
129-
}
130-
131117
if(attachKeyupEvent) {
132118
$element.bind('keyup', function() {
133119
$(this).doValidate(language, settings, false);
@@ -152,7 +138,6 @@
152138
var config = {
153139
ignore : [], // Names of inputs not to be validated even though node attribute containing the validation rules tells us to
154140
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
156141
errorMessageClass : 'jquery_form_error_message', // class name of div containing error messages when validation fails
157142
validationRuleAttribute : 'data-validation', // name of the attribute holding the validation rules
158143
errorMessagePosition : 'top', // Can be either "top" or "element"
@@ -240,11 +225,6 @@
240225
$form.find('input,textarea,select').each(function() {
241226
if (!ignoreInput($(this).attr('name'), $(this).attr('type'))) {
242227

243-
// memorize border color
244-
if (jQueryFormUtils.defaultBorderColor === null && $(this).attr('type')) {
245-
jQueryFormUtils.defaultBorderColor = $(this).css('border-color');
246-
}
247-
248228
var valid = jQueryFormUtils.validateInput(
249229
$(this),
250230
language,
@@ -263,9 +243,7 @@
263243
//
264244
// Reset style and remove error class
265245
//
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);
269247

270248

271249
//
@@ -282,9 +260,6 @@
282260

283261
// Apply error style to invalid inputs
284262
for (var i = 0; i < errorInputs.length; i++) {
285-
if (config.borderColorOnError !== '') {
286-
errorInputs[i].css('border-color', config.borderColorOnError);
287-
}
288263
errorInputs[i].addClass(config.errorElementClass);
289264
}
290265

@@ -336,11 +311,6 @@
336311
*/
337312
var jQueryFormUtils = {};
338313

339-
/**
340-
* Static variable for holding default border color on input
341-
*/
342-
jQueryFormUtils.defaultBorderColor = null;
343-
344314
/**
345315
* Validate email
346316
*

0 commit comments

Comments
 (0)