I am having trouble getting a document-level variable to "stick" after it is populated. The scenario is as follows:
In document-level script I have a couple of arrays:
Array 1 is a list of funds, for example:
var arrFundList = [["Code 1","Name English 1","Name French 1"],
["Code 2","Name English 2","Name French 2"],...
["Code 123","Name English 123","Name French 123"]];
and
var arrDocList = [[" ",""]];
There is also a function, fn_buildFundSelects() that when called does something as follows:
strLang = (this.getField("language").value == "French")?"F":"E";
for (var i=0;i<arrFundList.length;i++) {
arrDocList.push([(strLang == "F")?arrFundList[i][2]:arrFundList[i][1],arrFundList[i][0]]);
} // end FOR
The above loads the arrDocList array with fund information in either French or English and the export value equal to the fund code.
After the above, the value of a set of drop-down selection fields is set to the content of this array:
this.getField("select_1").clearItems();
this.getField("select_1").setItems(arrDocList);
This is repeated for each fund selection combo box on the form. The initialization function is executed by the Page.Open event. All of the above code works great and correctly populates the combo boxes.
The issue that I'm having is that the content of the document-level variable, arrDocList, is not retained. When I later try to reference it using some field-level scripts, it does not contain the expected 123 (or however many) number of elements but only contains the value that it was originally defined with.
Everything that I have read indicates that updates made to a document-level variable should be retained for the life of the document, making them global within the document; however, the behavior that I'm seeing makes it appear as if I'm running into some kind of scope limitation (of which I'm not aware). Any pointers to where I might be going wrong here would be GREATLY appreciated.
Thanks!
Rick