How to Use a List Box to Control Another Field in a PDF
Question details
The user wants to configure an interactive PDF form so that selecting a specific option in a list box (like "Other") automatically displays, enables, and requires an additional text field.

- Product
- PDF Editor
- Device & OS
- not provided
- Scenario
- Creating dynamic and conditional PDF forms where certain questions or text inputs should only appear based on previous user selections.
- Observed behavior
- The goal state is to have the dependent field remain hidden or read-only until the trigger option is selected, at which point the field becomes editable and required.
Ensure you are using a PDF editing software that supports advanced form creation and JavaScript execution, such as WPS Office or Adobe Acrobat.
Use the Selection Change Action with JavaScript
Configure the list box to commit values immediately and trigger a JavaScript function upon selection change to alter the target field's properties.
This is the most reliable method for conditional formatting. Avoid using a 'Mouse Up' action, as it may fail if the user navigates the form using the keyboard.
Open your PDF in form editing mode, right-click the list box field you want to serve as the trigger, and select 'Properties'.
Navigate to the 'Options' tab in the Properties window and check the box for 'Commit selected value immediately'. This ensures the form reacts the moment an option is clicked.
Go to the 'Actions' tab. From the 'Select Trigger' dropdown menu, choose 'Selection Change'. From the 'Select Action' dropdown, choose 'Run a JavaScript', then click 'Add'.
Enter the JavaScript code to evaluate the selection and change the target field's status. For example, use code to check if 'event.value' equals 'Other', and if so, set 'this.getField("targetField").display = display.visible;' and 'required = true;'.

Use a Custom Calculation Script
Place conditional logic directly inside the list box's calculation properties to automatically toggle the read-only and required status of your target field.
Create Dynamic Interactive PDFs with WPS Office
WPS Office provides robust PDF form editing tools, allowing you to insert list boxes, text fields, checkboxes, and apply custom JavaScript to build smart, conditional forms seamlessly.
- 1. Open your PDF: Launch WPS Office and open your PDF document.
- 2. Enter Form Mode: Click on the 'Form' tab in the top navigation ribbon to access interactive controls.
- 3. Insert Form Fields: Select 'List Box' and draw it on your document. Do the same for your dependent 'Text Field'.
- 4. Configure Logic: Double-click the List Box to access Properties, configure the 'Options' to commit immediately, and add your JavaScript under the 'Actions' tab.

Frequently Asked Questions
Why doesn't the target field update immediately after I select an option?
This usually happens because the 'Commit selected value immediately' setting is not checked in the list box's Options tab. Without this enabled, the selection isn't officially registered by the PDF until you click outside the box or move to another field.
Why shouldn't I use a 'Mouse Up' action for my list box?
Using a 'Mouse Up' trigger can cause logical errors if a user navigates or selects options using their keyboard (e.g., using arrow keys) instead of clicking with a mouse. Using 'Selection Change' or a custom calculation script is much more reliable across all input methods.
Can I hide the field completely instead of just making it read-only?
Yes. In your JavaScript, you can manipulate the display property. For example, use 'this.getField("myOtherField").display = display.hidden;' to completely hide the field, and 'display.visible' to show it when the correct option is selected.
Should I use a Combo Box instead of a List Box?
For triggering conditional logic based on specific choices, a List Box is generally recommended. Combo Boxes can allow users to type in their own custom text, which could easily break your JavaScript validation if they type something unexpected.




