I have this script at the document level (simplified) on a PDF:
function SetFieldValues(){
var Model = this.getField("Model");
var Armor = this.getField("Armor");
var Winch = this.getField("Winch");
var Test1 = this.getField("Test1");
var Test2 = this.getField("Test2");
if(event.willCommit) {
switch(event.value) {
case "015305676":
Model.value = "AMK23";
Armor.value = "YES";
Winch.value = "NO";
Test1.setItems[("Not Applicable")];
Test2.setItems[("-", "Serviceable", "Unserviceable")];
break;
}}}
This event is kicked off by the Custom Keystroke on the form's initiating dropdown list:
if( event.willCommit )
{
if(event.value == "-")
this.resetForm(["Model","Armor","Winch"]);
else
SetFieldValues(event.value)
}
All the fields update appropriately (Model, Armor, and Winch) however, the "Test" combo boxes do not populate as expected.
I then tried it a different way with this (which I thought would be genius using an array ...pfft... I was wrong):
function SetFieldValues(){
var Model = this.getField("Model");
var Armor = this.getField("Armor");
var Winch = this.getField("Winch");
const ArmorArray = [field='Test1', field='Test2'];
var ArmorArray;
var CheckOptionsY = {
Yes: [["-"],["Serviceable"],["Unserviceable"]],
};
var CheckOptionsN = {
No: [["Not Applicable"]],
};
if(event.willCommit)
{
switch(event.value) {
case "015305676":
Model.value = "AMK23";
Armor.value = "YES";
Winch.value = "NO";
ArmorArray.setItems[(CheckOptionsY)];
break;
}}}
Again, the fields update no problem (Model, Armor, and Winch) but the "Test" fields do not update with the combo box list options. What did I do wrong? How can I get these "Test" combo boxes to load with the appropriate 'Yes' / 'No' options?