How to Populate a Text Field with Multiple List Box Selections in Acrobat PDF
Question details
The user wants to extract multiple selected items from a list box and display them together in a separate text field.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating an interactive, fillable PDF form where a text field needs to automatically summarize or combine 3 to 5 names selected by a user from a list box.
- Observed behavior
- By default, the text field does not automatically retrieve multiple values from a list box. A custom JavaScript calculation script is required to pull the array of selections and format them as a single string.
Ensure your PDF form is in editing mode and you have already created both the source list box and the destination text field on your document.
Apply Custom JavaScript to the Text Field
Use Acrobat's built-in custom calculation script feature to extract multiple selected values from a list box and display them as a comma-separated list.
This method requires writing a short JavaScript snippet in the text field's properties. The script retrieves the array of selected items from your list box and joins them into a single, readable string.
First, ensure your list box allows multiple selections. Right-click your list box, go to Properties, navigate to the Options tab, and check the 'Multiple selection' box.
Right-click the destination text field where you want the names to appear and select 'Properties' from the context menu.
In the Text Field Properties dialog box, click on the 'Calculate' tab, then select the 'Custom calculation script' option and click the 'Edit' button.
Enter the following code into the JavaScript editor: var v = this.getField("List Box1").value; if (typeof v == "object") event.value = v.join(", "); else event.value = v; (Be sure to replace "List Box1" with the exact name of your list box field), then click OK.
Easily Edit and Manage PDF Forms with WPS Office
While advanced JavaScript calculation requires specific Acrobat tools, you can easily view, fill, and manage PDF forms using WPS Office's intuitive PDF features without dealing with heavy software.
- 1. Download and Install: Get the free WPS Office suite from the official website and launch the application on your computer.
- 2. Open Your PDF: Click 'Open' on the home screen and select your PDF form to launch it in the WPS PDF editor.
- 3. Fill and Edit: Use the 'Fill & Sign' or 'Form' tools available in the top ribbon to seamlessly interact with text fields, list boxes, and checkboxes.

Frequently Asked Questions
Why does my text field only show one value instead of multiple?
Make sure that the 'Multiple selection' option is enabled for your list box. You can find this setting by right-clicking the list box, selecting Properties, and checking the option under the Options tab.
How can I format the list to appear on separate lines instead of using commas?
In your JavaScript code, change the separator from a comma and space (", ") to a newline character ("\n"). Additionally, ensure that your destination text field has the 'Multi-line' option checked in its Properties under the Options tab.
Does this JavaScript work automatically on all PDF readers?
Form calculation scripts rely on the PDF reader's JavaScript engine. While it works perfectly in Adobe Acrobat and professional PDF editors, some basic mobile PDF viewers or web browser extensions may not support JavaScript calculations fully.




