mirror of
https://github.com/jquery-validation/jquery-validation.git
synced 2025-12-14 20:35:47 +01:00
Core: Validation fails to trigger when next field is already filled out
This change fix the bug when used with remote rule, it's already fixed
with other rules in commit 737630e788
Ref #1508
This commit is contained in:
17
src/core.js
17
src/core.js
@@ -289,7 +289,7 @@ $.extend( $.validator, {
|
||||
|
||||
if ( event.which === 9 && this.elementValue( element ) === "" || $.inArray( event.keyCode, excludedKeys ) !== -1 ) {
|
||||
return;
|
||||
} else if ( element.name in this.submitted || this.isValidElement( element ) ) {
|
||||
} else if ( element.name in this.submitted || element.name in this.invalid ) {
|
||||
this.element( element );
|
||||
}
|
||||
},
|
||||
@@ -487,6 +487,7 @@ $.extend( $.validator, {
|
||||
if ( $.fn.resetForm ) {
|
||||
$( this.currentForm ).resetForm();
|
||||
}
|
||||
this.invalid = {};
|
||||
this.submitted = {};
|
||||
this.prepareForm();
|
||||
this.hideErrors();
|
||||
@@ -539,18 +540,6 @@ $.extend( $.validator, {
|
||||
return this.size() === 0;
|
||||
},
|
||||
|
||||
// Check if the given element is valid
|
||||
// return
|
||||
// true If the field is valid
|
||||
// false If the field is invalid
|
||||
// undefined If the field is not validated yet.
|
||||
//
|
||||
// Note that this method assumes that you have
|
||||
// already called `validate()` on your form
|
||||
isValidElement: function( element ) {
|
||||
return this.invalid[ element.name ] === undefined ? undefined : !this.invalid[ element.name ];
|
||||
},
|
||||
|
||||
size: function() {
|
||||
return this.errorList.length;
|
||||
},
|
||||
@@ -1431,7 +1420,7 @@ $.extend( $.validator, {
|
||||
validator.prepareElement( element );
|
||||
validator.formSubmitted = submitted;
|
||||
validator.successList.push( element );
|
||||
delete validator.invalid[ element.name ];
|
||||
validator.invalid[ element.name ] = false;
|
||||
validator.showErrors();
|
||||
} else {
|
||||
errors = {};
|
||||
|
||||
Reference in New Issue
Block a user