Autofill an Adobe Acrobat Text Field from Three Dropdown Lists
Question details
Combine the selections from three PDF dropdown lists automatically in one text field.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- A PDF form has BuildingStyle, Width, and Length dropdowns and needs a single description based on their selections.
- Observed behavior
- The destination text field should display the selected values together and update when the selections change.
Open the PDF in Adobe Acrobat with access to Prepare a Form. Confirm that the three dropdown field names match BuildingStyle, Width, and Length exactly, and identify the destination text field.
Add a Custom Calculation Script to the Destination Text Field
Use this method to join nonempty dropdown values with spaces and display them in one calculated text field.
Open the PDF in Acrobat and select Prepare a Form from the tools menu.
Right-click the destination text field, choose Properties, and open the Calculate tab.
Select Custom calculation script, click Edit, and enter: var combinedValue = ""; if (this.getField("BuildingStyle").valueAsString != "") combinedValue += this.getField("BuildingStyle").valueAsString + " "; if (this.getField("Width").valueAsString != "") combinedValue += this.getField("Width").valueAsString + " "; if (this.getField("Length").valueAsString != "") combinedValue += this.getField("Length").valueAsString; event.value = combinedValue;
Confirm the script, close Properties, and save the PDF. Exit form editing, then change each dropdown selection and check the destination field.

Work with PDFs and Office Files in WPS Office
WPS Office is a free, lightweight alternative for viewing PDFs and working with Office documents in a familiar interface. It supports common Microsoft Office formats for easier migration, but use Acrobat to create and test this custom PDF calculation script.

Frequently Asked Questions
Where do I put the calculation script in Acrobat?
In Prepare a Form, open the destination text field's Properties, select the Calculate tab, and click Edit under Custom calculation script.
Why is the combined field blank or showing an error?
Check that BuildingStyle, Width, and Length exactly match the dropdown field names in Prepare a Form. Also test the PDF in Acrobat with JavaScript enabled.
Will the field update as soon as I select a dropdown option?
It updates when Acrobat commits the dropdown value and recalculates the form. To commit a choice immediately, check the dropdown field's Options tab for Commit selected value immediately.
What happens if a dropdown uses an export value?
The script reads each field's valueAsString, which may be the dropdown item's export value rather than its displayed label. Check the item settings in the dropdown field's Options tab if the result is unexpected.




