PDF Editing Issues

How to Get Text Instead of Numbers from an Acrobat JavaScript Dialog

Steven ParkerSteven Parker Nov 5, 2026 869 views

Question details

The user needs to retrieve the actual text (like a fruit name) selected in an Acrobat JavaScript dialog popup instead of its numeric export value.

How to Get Text Instead of Numbers from an Acrobat JavaScript Dialog
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Running a custom Acrobat JavaScript using the execDialog method with a popup list or dropdown menu.
Observed behavior
The dialog script returns the numeric export value associated with the item instead of the selected text string.
Before you start

Ensure you have access to the JavaScript console in your PDF editor and are familiar with the basic structure of the execDialog method.

Solution 1Recommended

Parse the Popup Selection for Text Identifiers

Modify your dialog result handling to capture the string text associated with the popup selection instead of defaulting to the numeric export value.

In an execDialog popup, the numeric values typically represent the export values of the various items. A positive value often indicates the item selected by default. To get the text, you must target the popup item identifier rather than the numeric value.

1
Identify the export values

Recognize that calling elements directly (like elements[i]) will return the numeric export value of the selected popup item.

2
Parse the selected identifier

Instead of using the export value, modify your script to retrieve the popup item identifier, which holds the actual text string of the selection.

3
Assign the parsed text

Use the extracted text string when assigning the result to your target field (e.g., this.getField("Text1").value = selectedText;) rather than passing the numerical index.

4
Reference documentation

Review Example 3 in the official Acrobat documentation for the execDialog method to see the exact syntax for correctly parsing the selected value of a popup field.

Parse the Popup Selection for Text Identifiers
Default Selections: Keep in mind that within the array structure, a positive numeric value indicates the item that is selected by default.
Efficient PDF Form Management

Manage PDF Forms Easily with WPS Office

WPS Office provides a comprehensive PDF editor that allows you to seamlessly create, edit, and fill out interactive PDF forms. You can easily manage field properties without writing complex JavaScript code.

  1. 1. Open your PDF: Launch WPS Office and open your PDF document using the built-in WPS PDF tool.
  2. 2. Access form tools: Navigate to the 'Form' tab on the top ribbon to view all interactive form controls.
  3. 3. Edit field properties: Right-click the dropdown or list box you want to edit and select 'Properties' from the context menu.
  4. 4. Set display and export values: Under the 'Options' tab, specify the 'Item Name' (the text users see) and 'Export Value' (the data collected) to manage outputs without complex scripts.
Easily configure form field display and export valuesHighly compatible with standard Adobe PDF formatsLightweight, fast, and features a user-friendly interfaceFree to use for basic PDF viewing and form filling
microsoft office alternative - wps office

Frequently Asked Questions

Why does my PDF dialog dropdown return a number instead of the name?

In Acrobat JavaScript, popup menu selections often default to returning the numeric export value or index of the item rather than the display text. You must explicitly parse the dialog result to extract the text identifier.

Where can I find examples of the execDialog method?

You can refer to the official Acrobat JavaScript API Reference. Specifically, Example 3 under the execDialog method documentation demonstrates how to correctly parse the selected value of a popup field.

Does WPS Office support editing interactive PDF forms?

Yes, WPS Office includes a powerful PDF editor that allows you to interact with, edit, and fill out PDF forms seamlessly, offering high compatibility with standard PDF interactive fields.