PDF Dropdown JavaScript Show/Hide Help
- February 8, 2024
- 1 reply
- 1395 views
Can anyone take a look at my PDF & script to tell me how to get the hidden addresses to appear when an option from the dropdown is selected.
Test file attached. Right now, you have to click on a selection from the dropdown, THEN click again anywhere on the PDF for that selection to appear.
Script I'm using:
var display = { visible: display.visible, hidden: display.hidden };
function showAddress() {
var locationValue = this.getField("Location").value;
this.getField("Address1").display = display.hidden;
this.getField("Address2").display = display.hidden;
this.getField("Address3").display = display.hidden;
// Show the corresponding display field based on the selected location
if (locationValue === "City, ST 1") {
this.getField("Address1").display = display.visible;
} else if (locationValue === "City, ST 2") {
this.getField("Address2").display = display.visible;
} else if (locationValue === "City, ST 3") {
this.getField("Address3").display = display.visible;
}
}
this.getField("Location").setAction("OnBlur", "showAddress()");
