What is wrong with this code?
Hi there!
The ultimate goal of this script is to set various field values throughout a form depending on what branch is chosen from a radio button group on the first page. I'm testing out the functionality with just two attributes - location name and address.
In my tests, I selected "KBAN" as my location and ran this in the console. It did not set the field values of ("LOCATION_NAME") and ("LOCATION_ADDRESS"), but it did return "321 XYZ Road" in the console window.
Any ideas why it won't set the field values?
Thank you!
var Location = this.getField("LOCATION").valueAsString; //radio button group
var arrLocations = ["KPOR",
"KBAN",
"KCON",
"KBUR",
"KRUT"];
var locIndex = arrLocations.indexOf(Location);
var arrName = ["Portland",
"Bangor",
"Concord",
"Burlington",
"Rutland"];
var arrAddress = ["123 ABC Road",
"321 XYZ Road",
"345 Any Road",
"543 Some Road",
"567 Another Road"];
var name = this.getField("LOCATION_NAME").value;
var address = this.getField("LOCATION_ADDRESS").value;
var arrFldAttributes = [name,
address];
var arrAttributeVals = [arrName,
arrAddress];
for (i=0; i < arrFldAttributes.length; i++) {
arrFldAttributes = arrAttributeVals[locIndex];
}
