How to Create a Dependent Drop-Down List or Price Field in PDF Forms
Question details
The user wants a secondary PDF form field (such as a price) to automatically update and display a specific value when an option is selected from a drop-down list.

- Product
- Adobe Acrobat / PDF Forms
- Device & OS
- not provided
- Scenario
- Creating interactive PDF forms where conditional or dependent fields need to auto-populate based on a user's previous selection.
- Observed behavior
- A programmatic solution or custom script is needed to link the selection from the source drop-down field to the output value of the destination field.
Ensure that your PDF editor supports JavaScript calculations. Before proceeding, you should have already created the source drop-down field (e.g., 'spaceSize') and the destination text field (e.g., 'Price') in your PDF document.
Use Custom JavaScript for Field Calculations
Add a custom calculation script to the target text field to map the drop-down options to specific output values.
To make a field dependent on a drop-down list, you can use a basic JavaScript array to map the selections to their respective prices. This script runs on the target field and listens to the values of the source field.
Open your PDF form in Edit mode, right-click the destination text field where the price should appear, and select 'Properties'.
In the Properties window, click on the 'Calculate' tab to view the calculation options for this specific field.
Select the 'Custom calculation script' option and click the 'Edit' button. Enter the following script, replacing the field name and values with your own: var prices = {'10x10':'$50', '10x20':'$100'}; event.value = prices[this.getField('spaceSize').value] || '';
Click 'OK' to save the script. Next, open the Properties for your source drop-down list, go to the 'Options' tab, and check the box for 'Commit selected value immediately' so the price updates instantly when a user makes a selection.

Create and Manage Interactive PDF Forms with WPS Office
WPS Office provides robust and easy-to-use PDF editing tools. You can quickly design interactive forms, add drop-down lists, and manage text fields without needing heavy or expensive software.
- 1. Open PDF Editor: Launch WPS Office and open your PDF document using the built-in PDF editor.
- 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to reveal the interactive form creation tools.
- 3. Add Fields: Select 'Combo Box' to insert a drop-down list or 'Text Field' for text inputs, then place them onto your document.
- 4. Configure Properties: Double-click the inserted fields to configure their properties, add drop-down options, or set formatting rules.

Frequently Asked Questions
Why isn't my dependent price field updating when I select a new option?
This usually happens because the PDF form waits for the user to click away from the drop-down before calculating. To fix this, open the properties of your drop-down list, go to the 'Options' tab, and check 'Commit selected value immediately'.
Can I use this JavaScript calculation for more than two drop-down options?
Yes. You can expand the JavaScript array to include as many key-value pairs as needed. Just ensure each option is separated by a comma, like this: var prices = {'10x10':'$50', '10x20':'$100', '10x30':'$150'};
Will this dependent drop-down list work in other PDF readers?
Yes, form calculations using standard JavaScript are widely supported. As long as the user's PDF reader supports interactive forms and JavaScript is enabled in their settings, the auto-population will work properly.




