Skip to content

Commit b528391

Browse files
committed
no validation if input is disabled, issue victorjonsson#91
1 parent ad73b02 commit b528391

File tree

9 files changed

+31
-10
lines changed

9 files changed

+31
-10
lines changed

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

form-validator/jquery.form-validator.js

Lines changed: 4 additions & 1 deletion
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.1.40
8+
* @version 2.1.41
99
*/
1010
(function($) {
1111

@@ -731,6 +731,9 @@
731731
*/
732732
validateInput : function($elem, language, conf, $form, eventContext) {
733733

734+
if( $elem.attr('disabled') )
735+
return null; // returning null will prevent that the valid class gets applied to the element
736+
734737
$elem.trigger('beforeValidation');
735738

736739
var value = $.trim( $elem.val() || ''),

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

form-validator/qunit.html

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,14 @@
5757
message = 'Check that input[value='+obj.val.attr('value')+'] is '+(obj.isValid ? 'valid':'invalid');
5858
}
5959

60-
if( $el.attr('data-validation-optional') && !$el.val() ) {
60+
if( result === null && obj.isValid ) {
61+
equal(
62+
result,
63+
null,
64+
message
65+
);
66+
}
67+
else if( $el.attr('data-validation-optional') && !$el.val() ) {
6168
equal(
6269
result,
6370
null,
@@ -192,6 +199,17 @@
192199
});
193200
});
194201

202+
203+
/*
204+
* ALPHANUMERIC VALIDATION
205+
*/
206+
test("Do not validate disabled", function() {
207+
clearForm();
208+
var $input = input('a--b', {'allowing':'', '':'alphanumeric'});
209+
$input.attr('disabled', 'disabled');
210+
runTest({val:$input, isValid: true});
211+
});
212+
195213
/*
196214
* NUMBER VALIDATION
197215
*/

form-validator/security.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
* @website http://formvalidator.net/#security-validators
1414
* @license Dual licensed under the MIT or GPL Version 2 licenses
15-
* @version 2.1.40
15+
* @version 2.1.41
1616
*/
1717
(function($) {
1818

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

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

0 commit comments

Comments
 (0)