Skip to content

Commit

Permalink
Form validation returns false when ajax validation returns true
Browse files Browse the repository at this point in the history
I fix this error with infomation by bartclaeys at this: posabsolute#954
  • Loading branch information
marcelosboeira authored Jul 17, 2019
1 parent 0eb1565 commit 64073af
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions js/jquery.validationEngine.js
Original file line number Diff line number Diff line change
Expand Up @@ -625,10 +625,19 @@
break;
case "ajax":
// AJAX defaults to returning it's loading message
errorMsg = methods._ajax(field, rules, i, options);
/*errorMsg = methods._ajax(field, rules, i, options);
if (errorMsg) {
promptType = "load";
}
}*/
errorMsg = methods._ajax(field, rules, i, options, function(errorMsg) {
if (errorMsg) {
promptType = "load";
}

if(errorMsg.isError==false) {
errorMsg.status = '_break';
}
});
break;
case "minSize":
errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._minSize);
Expand Down Expand Up @@ -1407,7 +1416,8 @@
* user options
* @return nothing! the ajax validator handles the prompts itself
*/
_ajax: function(field, rules, i, options) {
//_ajax: function(field, rules, i, options) {
_ajax: function(field, rules, i, options, callback) {

var errorSelector = rules[i + 1];
var rule = options.allrules[errorSelector];
Expand Down Expand Up @@ -1527,10 +1537,12 @@
}
}
errorField.trigger("jqv.field.result", [errorField, options.isError, msg]);
var obj = {alertTextLoad: rule.alertTextLoad, isError: !status};
callback(obj);
}
});

return rule.alertTextLoad;
//return rule.alertTextLoad;
}
},
/**
Expand Down

0 comments on commit 64073af

Please sign in to comment.