How to Get a List Box Item Display Value in an Acrobat Form
Question details
The user needs to retrieve the visible text of a selected list box item and populate it into another text field, bypassing the default export value.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Designing an interactive PDF form where a user's selection in a list box needs to display its text label in a separate hidden or visible text field.
- Observed behavior
- By default, referencing a list box field retrieves its export value instead of the actual text displayed to the user in the form.
Ensure you have a PDF editing program that supports adding custom JavaScript to form fields, such as Adobe Acrobat Pro. Note the exact field name of your list box before writing the script.
Use a Custom Calculation Script to Retrieve the Display Value
Apply a custom JavaScript calculation to the destination text field to capture the selected index of the list box and retrieve its text string instead of the export value.
By default, when you reference a list box in a PDF form, it returns the export value associated with the selection. To capture the visible text (the display value), you need to find the index of the selected item and use the getItemAt() method.
Open your PDF in Form Editing mode. Double-click the destination text field (the field where you want the value to appear) to open its Properties dialog box.
Click on the 'Calculate' tab at the top of the Properties window and select the 'Custom calculation script' option.
Click the 'Edit' button and paste the following script: var f = this.getField("List.Box.B"); var a = f.currentValueIndices; event.value = f.getItemAt(a, false);
Replace 'List.Box.B' in the script with the exact name of your list box field. Make sure to keep the quotation marks.
Click 'OK' to close the JavaScript editor, then click 'Close' on the Properties window. Exit Form Editing mode and test the list box to ensure the destination field populates with the correct display text.

Easily Manage and Fill PDF Forms with WPS Office
WPS Office includes a highly capable PDF editor that allows you to view, fill, and interact with complex PDF forms smoothly. It serves as an excellent, lightweight alternative for your daily PDF document needs.
- 1. Open WPS Office: Launch WPS Office and click on 'PDF Edit' or simply open your existing PDF form document.
- 2. Interact with Form Fields: Navigate to the form fields. WPS PDF automatically highlights fillable areas, allowing you to select list box items or type in text fields directly.
- 3. Save Your Form: Once the form is filled out, click 'Save' or 'Export' to securely store the completed document with all selections intact.

Frequently Asked Questions
Why does my list box default to the export value?
In PDF form architecture, the export value is typically used as the primary data point for backend processing and calculations, which is why default scripts pull the export value rather than the visual text label.
Can I use this same script for a drop-down (combo box) field?
Yes, the process is very similar. You can use the currentValueIndices property on a combo box to determine which item is selected and retrieve its display text using the getItemAt method.
What happens if multiple items are selected in the list box?
If your list box allows multiple selections, the currentValueIndices property will return an array of indices instead of a single number. You would need to write additional JavaScript to loop through the array and extract the text for each selected item.




