Show the Selected Lab Address in an Adobe Acrobat PDF Form
Question details
The user needs a PDF form to display the address of the selected testing laboratory and hide the other address.

- Product
- Adobe Acrobat PDF forms and Adobe Sign
- Device & OS
- not provided
- Scenario
- A user selects one of two testing laboratories in a form originally created as an Adobe Sign form.
- Observed behavior
- The desired form shows the selected lab's address, hides the unselected address, and shows neither address when no lab is selected.
Gather the two lab addresses and decide on the labels users will see in the dropdown. You will need Adobe Acrobat with form-editing and JavaScript capabilities, plus a standard PDF form rather than an Adobe Sign form.
Use a dropdown and JavaScript in a standard Acrobat form
Use this method to show one of two existing address fields based on the selected lab.
Adobe Sign forms do not support the same Acrobat JavaScript workflow. Start with the original non-Sign PDF or recreate the fields in a standard Acrobat PDF form.
The example below uses a dropdown with export values of None, Lab A, and Lab B. The address field names and export values must match the script exactly.
In Acrobat, open the original non-Sign PDF and choose All tools > Prepare a form. If necessary, recreate the form fields rather than using the Adobe Sign fields.
In Prepare a form, add two text fields named LabAAddress and LabBAddress and enter the corresponding addresses. Open each field's Properties, mark it read-only, and set its initial Form Field visibility to Hidden.
Add a dropdown field and open its Properties > Options. Add a prompt such as Select a lab with the export value None, followed by options with export values Lab A and Lab B. Select the prompt as the initial value and enable Commit selected value immediately.
In the dropdown's Properties > Validate tab, choose Run custom validation script and select Edit. Enter: this.getField("LabAAddress").display = event.value === "Lab A" ? display.visible : display.hidden; this.getField("LabBAddress").display = event.value === "Lab B" ? display.visible : display.hidden;
Save the PDF, exit form editing, and select each lab from the dropdown. Confirm that only its address appears, then select the prompt and confirm that both addresses are hidden.

Work with PDF and Office files in WPS Office
WPS Office is a free, lightweight alternative for everyday document work, with a familiar interface and compatibility with Microsoft Office formats to make migration easier. It does not replace the Acrobat JavaScript workflow required for this form.

Frequently Asked Questions
Why doesn't the script work in my Adobe Sign form?
Adobe Sign forms do not support the same Acrobat JavaScript workflow. Open the original non-Sign PDF in Acrobat's Prepare a form tool and create standard PDF fields for the dropdown and addresses.
How do I hide both addresses before a lab is selected?
Set each address field's Form Field visibility to Hidden in its Properties. Make the dropdown's initial option a prompt with an export value such as None, so the script hides both fields when that option is selected.
Why doesn't the address change when I select a different lab?
In the dropdown's Properties > Options, enable Commit selected value immediately. Then check that the field names and dropdown export values match those used in the validation script.
Will the form work in a browser PDF viewer?
Not necessarily. Some browser viewers do not run Acrobat form JavaScript. Test the form in Acrobat or Acrobat Reader with JavaScript enabled before distributing it.




