var ajaxFhNotComplete = 0; function setAjaxFhCounter(amount) { ajaxFhNotComplete += amount; } //to update a select field with the current list options function updateHierarchyField(parent, val) { //alert("call 1 "+parent.name+":" + ajaxFhNotComplete); setAjaxFhCounter(1); var testurl = '' + '?CONTEXT=' + mmContext+ '&page=com.other.AjaxUtil' + '&makeUniqueUrl=' + (new Date().valueOf()) + '&changedHs=' + parent.name + '&hsVal=' +val; jQuery.ajax({ url: testurl, async: onLoadDefaultsDone, success:function(data){ eval(data); // alert("exit 1-2: " + ajaxFhNotComplete); } }); setAjaxFhCounter(-1); // alert("exit 1-1: " + ajaxFhNotComplete); } //to update a select field with the current list options function populateHierarchyField(parentVal, fieldname) { //alert("call 2 "+fieldname+":" + ajaxFhNotComplete); setAjaxFhCounter(1); var url = '' + '?CONTEXT=' + mmContext+ '&page=com.other.AjaxUtil' + '&makeUniqueUrl=' + (new Date().valueOf()) + '&populateHs=' + fieldname + '&parentVal=' +parentVal; jQuery.ajax({ url: url, async: onLoadDefaultsDone, success:function(data){ eval(data); // alert("exit 2-2: " + ajaxFhNotComplete); } }); setAjaxFhCounter(-1); // alert("exit 2-1: " + ajaxFhNotComplete); } function customFitSubmitChecks(ret) { if (ajaxFhNotComplete > 0) { alert("Waiting for Field Hierarchies to finish updating. Please click OK and try again in a moment."); return false; } return ret; }