PDF Editing Issues

How to Display a PDF Combo Box Export Value with JavaScript

Rana GarciaRana Garcia Oct 28, 2026 869 views

Question details

The user needs to retrieve and display the selected export value from a combo box field in a PDF using JavaScript.

Display a PDF Combo Box Export Value with JavaScript
Product
PDF Editor
Device & OS
not provided
Scenario
Creating or editing interactive PDF forms requiring custom JavaScript calculations.
Observed behavior
The user wants a JavaScript solution to successfully extract a combo box's chosen export value as text.
Before you start

Ensure that your PDF document contains a combo box form field with predefined export values, and that your PDF editor supports custom JavaScript actions.

Solution 1Recommended

Use the valueAsString Property to Retrieve the Export Value

You can extract the exact export value by targeting the combo box field and utilizing the valueAsString property in your JavaScript code.

When dealing with interactive PDF forms, combo boxes often display one set of text to the user while storing a different underlying 'export value' for calculations or backend data handling. Accessing this value requires a specific scripting approach.

1
Open JavaScript editor

Open your PDF form in editing mode. Right-click the target field where you want to display the value, select 'Properties', and navigate to the 'Calculate' or 'Action' tab to enter a custom JavaScript.

2
Target the combo box field

Declare a variable to reference your combo box by its exact name. For example: var field = this.getField("ComboBox1");

3
Extract and assign the value

Use the valueAsString property to get the text of the export value and assign it to the current event. Add this line: event.value = field.valueAsString;

4
Save and test

Close the script editor, exit form editing mode, and test the combo box. The target field should now automatically update to display the chosen item's export value.

Use the valueAsString Property to Retrieve the Export Value
Formatting Note: The valueAsString property is highly reliable because it forces the retrieved data to be formatted strictly as a text string, preventing unexpected calculation errors.
Edit Interactive PDF Forms with WPS Office

Easily Manage PDF Forms and Fields in WPS PDF

WPS Office offers a comprehensive suite of PDF tools, allowing you to easily insert, edit, and configure interactive form fields such as combo boxes, text boxes, and buttons without needing complex scripting.

  1. 1. Open your PDF in WPS: Launch WPS Office, click on 'PDF', and open your interactive PDF document.
  2. 2. Access the Form tab: Navigate to the 'Form' tab in the top ribbon to reveal the interactive form toolkit.
  3. 3. Edit the Combo Box: Select the 'Combo Box' tool. Double-click the existing combo box to open its properties and easily define or modify display items and their export values.
  4. 4. Save changes: Click 'Save' to apply your adjustments. You can preview the interactive elements immediately within the WPS PDF viewer.
Intuitive tools for building interactive PDF forms from scratchSeamlessly compatible with Microsoft Office formats and standard Adobe PDF filesLightweight application that uses minimal system resourcesBuilt-in PDF reader and editor for viewing and filling forms accurately
microsoft office alternative - wps office

Frequently Asked Questions

What is an export value in a PDF combo box?

An export value is the specific background data tied to a selection in a combo box. While a user might see a descriptive label in the dropdown menu, the PDF script or form data extraction process uses the shorter or numerically formatted export value.

Why does my JavaScript return the display text instead of the export value?

Depending on the PDF viewer and how the standard 'value' property is accessed, the form may default to returning the face text. Using 'valueAsString' explicitly commands the script to retrieve the underlying chosen export value instead.

Can I use the retrieved export value in a calculation?

Yes. Once you retrieve the export value using valueAsString, you can convert it to a number using JavaScript functions like Number() or parseFloat(), and then use it in standard mathematical operations for order forms or invoices.