JavaScript not working properly during OnLoad

Use this board to ask questions or have discussions with other Atrium users.
Post Reply
richie.moore
New User
Posts: 1
Joined: Fri May 14, 2021 8:45 am
First Name: Richie
Last Name: Moore
Company Name: Sapiens
Phone: 3217506000
Address 1: 12001 Research Parkway
Address 2: Suite 128
City: Orlando
State / Province: Florida
Zip / Postal Code: 32826
Country: United States
Contact:

JavaScript not working properly during OnLoad

Post by richie.moore »

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
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: JavaScript not working properly during OnLoad

Post by Scott Klement »

Hmm... are you using the old (insecure) security level for SQL statements?

If you have the secure mode enabled, changing the selection criteria with JavaScript shouldn't have any impact at all.

You should be doing this with parameter markers and parameter values.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest