Drop down to show/hide layers and text fields
Hello,
I am new to Acrobat/Javascript and have been using tutorials on here to come up with a barebones worksheet. I am using this code to show different text fields & layers based on drop down selection but the text fields for HHG & NTS are not showing up when testing. This is the code I am using;
var layers = this.getOCGs();
var v = event.value;
for (var i = 0; i < this.layers.length; i++) {
if (layers[i].name == "HHGNTSc1" && v == "Household Goods (HHG)") {
layers[i].state = true;
this.getField("Group1").display = display.visible;
this.getField("Group2").display = display.hidden;
} else if (layers[i].name == "HHGNTSc1" && v == "Storage (NTS)") {
layers[i].state = true;
this.getField("Group1").display = display.visible;
this.getField("Group2").display = display.hidden;
} else if (layers[i].name == "UBc1" && v == "Unaccompanied Baggage (UB)") {
layers[i].state = true;
this.getField("Group2").display = display.visible;
this.getField("Group1").display = display.hidden;
} else if (v == "Select Shipment Type") {
layers[i].state = false;
this.getField("Group1").display = display.hidden;
this.getField("Group2").display = display.hidden;
} else {
layers[i].state = false;
this.getField("Group1").display = display.hidden;
this.getField("Group2").display = display.hidden;
}
}
Thank you.
