Convert Multiline Text to Dropdown Options in Adobe Acrobat
Question details
The user wants to turn each line of a multiline PDF form field into a separate dropdown option.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- An Acrobat PDF form contains a multiline text field whose contents should populate a dropdown field.
- Observed behavior
- Each line of the text field should appear as a separate option in the dropdown.
Open the PDF in Adobe Acrobat and confirm that it has a multiline text field and a dropdown field. In Prepare a Form, check the exact names of both fields and enter the source text with one option per line.
Populate the Acrobat dropdown with JavaScript
Use this method to replace the dropdown's existing options with the lines from the text field.
The script reads the text as a string, splits it at carriage returns or line breaks, and passes the resulting array to the dropdown field. Acrobat form JavaScript does not support an addItem method.
Open Prepare a Form and inspect the text field and dropdown properties. Note their exact names, including capitalization.
Open Acrobat's JavaScript console; on Windows, press Ctrl+J. Replace MultilineTextField and YourDropdownFieldName in the script below with your field names.
Paste and execute this script in the JavaScript console: var items = this.getField("MultilineTextField").valueAsString.split(/[\r\n]+/); this.getField("YourDropdownFieldName").clearItems(); this.getField("YourDropdownFieldName").setItems(items);
Close the console and open the dropdown in the PDF to check that each line appears as an option. Save the PDF if the result is correct.

Work with PDFs and Office files in WPS Office
For everyday document work, WPS Office is a free, lightweight alternative with a familiar interface and support for common Office formats, making it easy to move between applications. Use Adobe Acrobat for the form JavaScript task described above; WPS Office is not a substitute for running that script.

Frequently Asked Questions
How do I find the exact names of my Acrobat form fields?
Open Prepare a Form, select each field, and inspect its properties for the field name. Use those exact names in the getField calls.
Will the script keep the dropdown's existing options?
No. The clearItems call removes the existing options, and setItems populates the dropdown with the lines from the text field.
Why doesn't addItem work in Acrobat form JavaScript?
Acrobat form JavaScript does not support an addItem method. Use the dropdown field's setItems method with an array of options instead.
What should I do if the dropdown contains an empty option?
Check the source text field for leading or trailing line breaks, remove them, and run the script again. An empty source field can also produce an empty option.




