Other PDF Issues

How to Set a PDF Field Value for Custom Drop-Down Text

Jason MillerJason Miller Oct 28, 2026 869 views

Question details

The user wants to automatically display a specific value in a PDF form field when a user inputs a custom value not present in a related drop-down list.

How to Set a PDF Field Value When Custom Drop-Down Text Is Entered
Product
PDF
Device & OS
not provided
Scenario
Creating or editing a fillable PDF form with dependent fields, specifically making a target field react to custom user input in a drop-down list.
Observed behavior
A dynamic setup is needed so that if a user types a custom value in the 'Passenger 1' drop-down that is not 'Yes', the dependent 'Passholder' field displays 'No'.
Before you start

Ensure you are using a PDF editor that supports advanced form editing and JavaScript execution, and verify the exact name of your target drop-down field before proceeding.

Solution 1Recommended

Apply a Conditional Calculation Script via Field Properties

Use a custom JavaScript calculation script in the dependent field's properties to evaluate the text input from the drop-down list dynamically.

In fillable PDF forms, drop-down lists can be configured to allow users to type custom text. To make another field (like a Passholder status field) change its value based on this input, you can apply a short JavaScript condition.

The script checks if the drop-down's value exactly matches a predefined string (like 'Yes'). If it does, the field displays 'Yes'; if any other custom text is entered, it defaults to 'No'.

1
Enter Form Editing Mode

Open your PDF document in your PDF editor and navigate to the 'Form' tab to enable form editing mode.

2
Access Dependent Field Properties

Right-click the dependent field (e.g., the Passholder text field) and select 'Properties' from the context menu.

3
Navigate to the Calculate Tab

In the Properties dialog box, click on the 'Calculate' tab to view the calculation options.

4
Enter the Custom Script

Select the 'Custom calculation script' radio button, click 'Edit', and paste the following code: event.value = (this.getField("Passenger 1").valueAsString == "Yes") ? "Yes" : "No";

5
Save and Test

Click 'OK' to save the script, close the Properties dialog, exit form editing mode, and test the drop-down by typing a custom value.

Apply a Conditional Calculation Script via Field Properties
Match Field Names Exactly: Ensure that "Passenger 1" in the script exactly matches the name of your drop-down field. Field names in PDF JavaScript are case-sensitive.
Advanced PDF Form Editor

Create Interactive PDF Forms with WPS Office

WPS Office provides a comprehensive PDF toolkit that allows you to design fillable forms, configure drop-down lists, and manage advanced field properties with ease.

  1. 1. Open PDF in WPS: Launch WPS Office and open your PDF document to begin editing.
  2. 2. Access Form Tools: Click on the 'Form' tab on the top ribbon to reveal the interactive form toolkit.
  3. 3. Edit Field Properties: Double-click any form field to instantly access its properties, styling, and calculation rules.
Easily create and customize interactive PDF forms with text fields, drop-downs, and calculation properties.Fully compatible with standard PDF formats and widely used form logic.Lightweight and intuitive interface designed for fast, seamless PDF editing.
microsoft office alternative - wps office

Frequently Asked Questions

Why isn't my PDF calculation script updating the field?

This usually happens if the field name referenced in the script doesn't exactly match the actual field name in the form. Check for typos, extra spaces, and ensure the capitalization is identical. Also, ensure your PDF reader supports JavaScript.

How do I allow users to type custom text into a drop-down list?

In form editing mode, right-click the drop-down field and go to 'Properties'. Under the 'Options' tab, check the box labeled 'Allow user to enter custom text' (or similar wording, depending on your editor).

Will this JavaScript calculation work on mobile PDF viewers?

Many mobile PDF viewers and built-in browser readers do not fully support interactive JavaScript calculations. For the best experience, users should fill out the form using robust desktop software like WPS Office or Adobe Acrobat.