JavaScript not working properly during OnLoad
Posted: Fri May 14, 2021 8:58 am
The function below works properly with onchange but not with onload. The main purpose of the function is to set "choices selection criteria" but during onload the drop down contains all divisions for EMco# and EMfnd and it does not select based on EMemp#. If I put this code in debug and step through it then it works just fine. Is there a timing issue with screen loading and setting these properties? I tried just moving this field down to the bottom of the screen and then it worked fine but later when I had to make more changes to the field it stopped working again. Any ideas would be appreciated.
window.divisionSelections = function() {
var company = get("TxbCo#");
var group = get("DrpPopGroup");
var employer = parseInt(get("TxbEmployer"));
var disEmployer = "true";
if (employer > 0){
disEmployer = "false";
changeElementValue("DrpPolicyDivision", "");
}
applyProperty("DrpPolicyDivision", "disabled", disEmployer);
//apply selection critera based on employer info to
var divChoices = 'EMco# = ' + company.toString() + ' and EMfnd = ' + group.toString() + ' and EMemp# = ' + employer.toString();
applyProperty("DrpPolicyDivision", "choices selection criteria", divChoices);
applyProperty("DrpPolicyDivision", "field type", "select box");
}
Thanks
Richie
window.divisionSelections = function() {
var company = get("TxbCo#");
var group = get("DrpPopGroup");
var employer = parseInt(get("TxbEmployer"));
var disEmployer = "true";
if (employer > 0){
disEmployer = "false";
changeElementValue("DrpPolicyDivision", "");
}
applyProperty("DrpPolicyDivision", "disabled", disEmployer);
//apply selection critera based on employer info to
var divChoices = 'EMco# = ' + company.toString() + ' and EMfnd = ' + group.toString() + ' and EMemp# = ' + employer.toString();
applyProperty("DrpPolicyDivision", "choices selection criteria", divChoices);
applyProperty("DrpPolicyDivision", "field type", "select box");
}
Thanks
Richie