mirror of
https://github.com/jquery-validation/jquery-validation.git
synced 2025-12-14 20:35:47 +01:00
Core: Error hidden but input error class not removed
When a field has one rule with option `depends` specified and this dependency mismatch, the plugin will remove it, so that field will not be validated on submit by the the rule in question. So if that field is already invalid, only the error message will be hidden and the error class will remain. This commit fixes this issue. Fixes #1632
This commit is contained in:
committed by
Markus Staab
parent
9d00c2b9ff
commit
ef6821aba3
@@ -490,10 +490,16 @@ $.extend( $.validator, {
|
||||
this.submitted = {};
|
||||
this.prepareForm();
|
||||
this.hideErrors();
|
||||
var i, elements = this.elements()
|
||||
var elements = this.elements()
|
||||
.removeData( "previousValue" )
|
||||
.removeAttr( "aria-invalid" );
|
||||
|
||||
this.resetElements( elements );
|
||||
},
|
||||
|
||||
resetElements: function( elements ) {
|
||||
var i;
|
||||
|
||||
if ( this.settings.unhighlight ) {
|
||||
for ( i = 0; elements[ i ]; i++ ) {
|
||||
this.settings.unhighlight.call( this, elements[ i ],
|
||||
@@ -1191,6 +1197,7 @@ $.extend( $.validator, {
|
||||
if ( keepRule ) {
|
||||
rules[ prop ] = val.param !== undefined ? val.param : true;
|
||||
} else {
|
||||
$.data( element.form, "validator" ).resetElements( $( element ) );
|
||||
delete rules[ prop ];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user