mirror of
https://github.com/jquery-validation/jquery-validation.git
synced 2025-12-14 20:35:47 +01:00
Core: core.js, methods.js, Fix for #1567 - jquery-validation ignores data obj when validating, incorrectly returning previous status
This change determines if either the validated element's value OR one of the data properties has changed before aborting the remote request. If your remote validation is skipped due to being dependent on the value of another field, this fixes that issue.
This commit is contained in:
@@ -1291,7 +1291,7 @@ $.extend( $.validator, {
|
||||
}
|
||||
|
||||
var previous = this.previousValue( element ),
|
||||
validator, data;
|
||||
validator, data, optionDataString;
|
||||
|
||||
if (!this.settings.messages[ element.name ] ) {
|
||||
this.settings.messages[ element.name ] = {};
|
||||
@@ -1300,12 +1300,12 @@ $.extend( $.validator, {
|
||||
this.settings.messages[ element.name ].remote = previous.message;
|
||||
|
||||
param = typeof param === "string" && { url: param } || param;
|
||||
|
||||
if ( previous.old === value ) {
|
||||
optionDataString = $.param( $.extend( { data: value }, param.data ) );
|
||||
if (previous.old === optionDataString) {
|
||||
return previous.valid;
|
||||
}
|
||||
|
||||
previous.old = value;
|
||||
previous.old = optionDataString;
|
||||
validator = this;
|
||||
this.startRequest( element );
|
||||
data = {};
|
||||
|
||||
Reference in New Issue
Block a user