From ce300491cdcd5957e4e22304dffccf648f645519 Mon Sep 17 00:00:00 2001 From: jordan kapelner Date: Fri, 14 Mar 2014 18:31:46 -0400 Subject: [PATCH] fixed asyncfunccall to prevent returning with load message if callback returns too quickly --- js/jquery.validationEngine.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/jquery.validationEngine.js b/js/jquery.validationEngine.js index 9c6714e..af61554 100644 --- a/js/jquery.validationEngine.js +++ b/js/jquery.validationEngine.js @@ -1148,7 +1148,12 @@ } }); - return rule.alertTextLoad; + if (options.asyncInProgress[field.attr("id")]) { + return rule.alertTextLoad; //if async function is still in progress, show the loading prompt + } + else if (options.ajaxValidCache[field.attr("id")] === false) { //if the callback returned quickly and validation failed + return {status: '_error_no_prompt'}; //force our caller to fail and bail (don't change the prompt, since that was already done by the callback) + } } else if (options.ajaxValidCache[field.attr("id")] === false) { //if validation previously failed, but did not change return {status: '_error_no_prompt'}; //force our caller to fail and bail (don't change the prompt)