PDF Editing Issues

How to Auto-Populate PDF Fields Based on User Input in Acrobat Pro

Aamir Naveed AkramAamir Naveed Akram Nov 24, 2026 868 views

Question details

The user wants to automatically fill dependent form fields in a PDF document based on the value typed into a primary trigger field.

How to Auto-Populate PDF Fields Based on User Input in Acrobat Pro
Product
Adobe Acrobat Pro
Device & OS
not provided
Scenario
Creating an interactive PDF form where specific inputs (like a Job Code) automatically trigger the population of related fields (like Pay Rate and Job Title).
Observed behavior
The user needs the correct JavaScript logic and application steps to establish dynamic dependencies between the primary and secondary PDF form fields.
Before you start

Before proceeding, ensure your PDF form contains all necessary text fields with clearly defined and unique field names (e.g., 'Job Code', 'Pay Rate') to act as triggers and dependent fields.

Solution 1Recommended

Use Custom Validation JavaScript on the Primary Field

Apply a custom JavaScript snippet utilizing a 'switch' statement on the trigger field to detect the user's input and push data to the dependent fields.

To achieve automatic field population, you must assign a custom validation script to the primary field. When the user exits the primary field, the script captures the entered value using 'event.value' and updates the dependent fields using 'this.getField().value'.

1
Enter Prepare Form Mode

Open your document in Adobe Acrobat Pro, go to the 'Tools' menu, and select 'Prepare Form' to enable form editing.

2
Access Field Properties

Right-click the primary trigger field (for example, the 'Job Code' field) and click on 'Properties' from the context menu.

3
Navigate to the Validate Tab

In the Properties dialog box, select the 'Validate' tab at the top, then choose the 'Run custom validation script' radio button.

4
Input the JavaScript Code

Click the 'Edit' button and input your JavaScript using a switch statement. For example: var Rate = this.getField('Pay Rate'); var Title = this.getField('Job Title'); switch(event.value){ case '123': Rate.value = 'XXX'; Title.value = 'XXX'; break; default: Rate.value = ''; Title.value = ''; }

5
Save and Test

Click 'OK' to save the script, close the Properties window, and exit form editing mode to test your new auto-populating fields.

Use Custom Validation JavaScript on the Primary Field
Use the Default Case: Always include a 'default' case in your switch statement to clear the dependent fields if the user enters an unrecognized value or deletes their input.

Create and Fill Interactive PDF Forms with WPS Office

WPS PDF offers a comprehensive set of easy-to-use tools to create, edit, and fill interactive PDF forms without requiring complex programming knowledge.

  1. 1. Open PDF in WPS Office: Launch WPS Office and open your PDF document using the WPS PDF editor.
  2. 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon menu to view the available interactive form elements.
  3. 3. Add Form Fields: Click on 'Text Field', 'Check Box', or 'Combo Box' and click on the page to place your new form field.
  4. 4. Adjust Properties: Double-click the inserted field to modify its name, appearance, and value settings.
  5. 5. Save the Document: Once your form is designed, save the document. It is now ready to be shared and filled by users.
Easily insert text fields, checkboxes, and dropdowns visually.Fully compatible with standard Adobe PDF forms and formats.Lightweight software with fast performance for viewing and editing large PDFs.Cost-effective solution for everyday PDF management and form filling.
microsoft office alternative - wps office

Frequently Asked Questions

How can I find the exact field names in my PDF form?

While in form editing mode, the field names are displayed directly over the field boxes. You can also view a comprehensive list of all form fields in the fields panel, usually located on the right side of the screen.

What happens if a user enters a value not defined in the JavaScript?

If you included a 'default:' case in your switch statement, the script will execute that block. It is highly recommended to use the default case to clear the dependent fields so incorrect data doesn't remain on the form.

Can I auto-populate multiple dependent fields from a single trigger field?

Yes. Within each case of your switch statement, you can declare and assign values to as many dependent fields as needed simply by referencing their unique field names and setting their respective values.

Why isn't my custom JavaScript running when I type in the field?

Ensure that your field names in the script exactly match the actual field names, including capitalization. Also, check your PDF viewer's security preferences to confirm that JavaScript execution is enabled.