How to Use Multiple Dropdown Export Values in Acrobat PDF Forms
Question details
Populate two distinct PDF form fields with different approver names based on a single dropdown menu selection.

- Product
- Adobe Acrobat PDF
- Device & OS
- not provided
- Scenario
- Creating advanced interactive PDF forms where selecting an option from a dropdown needs to dynamically fill multiple related text fields.
- Observed behavior
- By utilizing a custom delimiter in the export value, a calculation script successfully splits the string and assigns the separate values to their corresponding target text fields.
Ensure that your PDF editing software has form editing and JavaScript execution capabilities enabled, and take note of the exact field names you intend to use.
Use a Delimiter and Custom Calculation Script
Store multiple values within a single dropdown export value separated by a character (like a pipe), then use JavaScript to split and distribute the values.
A dropdown field in a PDF can technically only have one export value. However, this value can be any string. By joining multiple values together with a specific delimiter character, you can use a custom script to split that string back into multiple parts and populate other fields accordingly.
Open the properties of your dropdown field. In the Options tab, set the Export Value for your item to include both names separated by a pipe character (e.g., "Jimmy Buffett|Steve Goodman"). Ensure you include the pipe character for all items, even if there is only one name (e.g., "Single Name|").
Open the properties for the first target text box. Navigate to the Calculate tab, choose 'Custom calculation script', and click Edit. Paste the following JavaScript: (function () { var sNames = getField("Dropdown1").valueAsString; var aNames = sNames.split("|"); var f2 = getField("Name2"); if (aNames.length === 2) { event.value = aNames[0]; f2.value = aNames[1]; } else { event.value = ""; f2.value = ""; } })();
In the script you just pasted, change "Dropdown1" to the exact name of your dropdown field, and change "Name2" to the exact name of your second target text box. Click OK and close the properties window to apply the changes.

Create and Manage Interactive Forms with WPS Office
WPS Office includes a robust PDF editor that allows you to effortlessly design, fill, and manage interactive PDF forms without complex setups.
- 1. Open your PDF: Launch WPS Office and open your PDF document using the WPS PDF tool.
- 2. Access the Form Tab: Navigate to the 'Form' tab on the top ribbon to reveal all interactive form controls.
- 3. Add or Edit Fields: Select the dropdown or text field icons to add new elements, or double-click existing fields to modify their properties and options.
- 4. Save and Export: Once your form is configured, click 'Save' to preserve the interactive elements for user distribution.

Frequently Asked Questions
Can I use a character other than a pipe (|) as my delimiter?
Yes, you can use commas, hyphens, tildes, or any other character as a delimiter. Just ensure the character you choose will never naturally appear within the actual names or values, and remember to update the .split("|") function in the script to match your new delimiter.
Why are my target text fields not updating when I make a dropdown selection?
This usually happens if JavaScript is disabled in your PDF viewer or if the field names referenced in the script (like "Dropdown1" and "Name2") do not exactly match the actual names of your form fields. Form field names are case-sensitive.
What happens if one of the dropdown options only has one approver name?
To prevent the script from malfunctioning, you should still include the delimiter in the export value. For example, use "John Doe|". The script will assign 'John Doe' to the first field and leave the second field blank.
Can I extend this script to populate three or more fields?
Absolutely. You can add more delimiters in your export value (e.g., "Name1|Name2|Name3"). In your script, declare a variable for the third field (var f3 = getField("Name3");), change the array length check to 3, and add f3.value = aNames[2]; to the execution block.




