How to Populate PDF Form Fields from Dropdown and Radio Button Choices
Question details
The user needs to automatically fill target PDF form fields based on the selections made in a dropdown list and a radio button group.

- Product
- PDF Editor
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form where values like application or registration fees change dynamically based on user input.
- Observed behavior
- Requires a method to evaluate dropdown and radio button selections and assign appropriate values to specific text fields.
Ensure your PDF form already contains the necessary dropdown lists, radio button groups, and destination text fields, and that each field has a unique, recognizable name.
Use Field-Level Custom Calculation Scripts
Add a custom JavaScript calculation directly to the target field so it automatically updates when the dropdown or radio button changes.
This approach uses a custom script placed in the target field's properties. The script evaluates the current values of the dropdown or radio buttons and directly outputs the result.
Right-click the target text field (e.g., 'App_Fee') and select 'Properties' from the context menu.
In the Properties dialog box, click on the 'Calculate' tab to set up the field's calculation logic.
Select the 'Custom calculation script' option and click 'Edit'. Enter your JavaScript code to evaluate the dropdown value (using `this.getField("DropdownName").value`) and assign the fee.
Click 'OK' to save the script, close the properties window, and test your form by changing the dropdown or radio button selections to see the field update.

Use Document-Level JavaScript
Create a centralized function at the document level to manage complex logic that updates multiple fields simultaneously.
Create and Manage Interactive PDF Forms with WPS Office
WPS Office provides robust PDF editing capabilities, allowing you to easily insert text fields, dropdowns, and radio buttons to build highly interactive and professional forms.
- 1. Open your PDF in WPS Office: Launch WPS Office and open the PDF document you want to convert into an interactive form.
- 2. Access the Form Tools: Click on the 'Form' tab in the top navigation ribbon to reveal the form creation tools.
- 3. Add Interactive Elements: Select 'Text Field', 'Drop-Down', or 'Radio Button' to insert them into your document, then double-click them to adjust their properties and logic.

Frequently Asked Questions
Can I populate a PDF text field conditionally without using JavaScript?
Simple predefined calculations (like sum or product) can be done without scripts via the Calculate tab. However, conditional logic—such as assigning specific values based on dropdown or radio button choices—requires custom JavaScript.
Why is my PDF form calculation script not updating the field?
Check for syntax errors in your JavaScript code, ensure the field names in the script match the actual form field names exactly (they are case-sensitive), and verify that the script is placed in the correct trigger event (like the Calculate tab of the target field).
Are PDF JavaScript forms compatible across all document viewers?
While standard desktop PDF editors like WPS PDF and Adobe Acrobat fully support JavaScript in forms, some basic web browsers or mobile PDF viewers might not fully execute complex scripts. Always test your forms in the intended viewer.




