How to Display Selected List Box Items in a PDF Text Field
Question details
The user needs a method to copy one or multiple selected values from a list box and display them seamlessly into a designated multiline text field within a PDF form.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating or editing an interactive PDF form where data from a list box needs to be dynamically transferred to another text area for display.
- Observed behavior
- The user expects the text field to automatically populate and format the values chosen from the list box.
Ensure you have access to the form editing tools in your PDF application and take note of the exact field name used for your list box.
Use a Custom Calculation Script to Link the Fields
By configuring field properties and applying a short custom calculation script, you can automatically pass values from a list box directly to your multiline text field.
This method requires adjusting the properties of both your list box and your destination text field to allow multiple values. Once configured, a custom JavaScript snippet added to the destination field handles the data transfer automatically.
Right-click your list box field and select Properties. Navigate to the Options tab and check the 'Multiple selection' box.
Right-click your destination text field and select Properties. Go to the Options tab and check the 'Multi-line' option to ensure items display on separate lines.
While still in the destination text field's Properties window, click on the Calculate tab. Choose 'Custom calculation script' and click the 'Edit' button.
Paste the following script into the editor: var f = this.getField('myTextField'); var a = f.currentValueIndices; event.value = ''; if (typeof a == 'number') event.value = f.getItemAt(a, false); else for (var i = 0; i < a.length; i++) event.value += (i ? '\n' : '') + f.getItemAt(a[i], false);
Replace 'myTextField' in the first line of the script with the exact, case-sensitive name of your actual list box field, then click OK and close the properties window.

Easily Edit and Fill PDF Forms with WPS Office
WPS Office provides a highly capable PDF toolkit that makes it simple to read, edit, fill out forms, and manage your PDF documents seamlessly without needing heavy, expensive software.
- 1. Open your PDF in WPS: Launch WPS Office, select the 'PDF' module, and open your form document.
- 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to view all interactive form and editing options.
- 3. Edit or Fill Fields: Click directly on the text fields or list boxes to fill in your data, or use editing tools to modify the document layout.
- 4. Save your Document: Click 'Save' or 'Export to PDF' to preserve your inputs and interactive form changes.

Frequently Asked Questions
Why are all the selected list box items appearing on a single line?
This happens if the 'Multi-line' option is not enabled in the destination text field. Open the text field's Properties, go to the Options tab, and ensure 'Multi-line' is checked.
Does this custom calculation script work if I only select one item?
Yes, the script includes a condition that identifies if the selection is a single number value. It processes single selections just as flawlessly as multiple selections.
Will this JavaScript formula work on mobile PDF readers?
JavaScript support varies significantly across mobile PDF viewers. While this custom script works reliably on desktop applications like Adobe Acrobat and advanced PDF editors, some mobile apps may not execute the background calculations required to transfer the values.




