How to Automatically Populate PDF Form Fields from Another Field
Question details
The user wants to configure a PDF form so that entering a value in one text field automatically populates several other fields with the same value, while allowing those linked fields to remain independently editable afterwards.

- Product
- PDF Editor
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form where certain fields share a default starting value based on a primary input field.
- Observed behavior
- By default, text fields do not automatically sync their values when modified unless configured with identical names (which prevents independent editing) or custom scripting.
Ensure your PDF editing software supports form creation and custom JavaScript execution, and write down the exact names of the target fields you want to populate.
Use a Custom JavaScript Validation Event
Applying a validation script to the source field allows it to push its value to other specific fields dynamically whenever it is updated.
This method involves adding a simple JavaScript snippet to the 'Validate' tab of your primary text field. Because the script pushes the value to the target fields rather than locking them together, users can still modify the target fields individually if needed.
Open your PDF document in your PDF editor and switch to the Form Preparation or Form Editing mode.
Right-click the primary text field (the source field that users will fill out first) and select 'Properties'.
In the Properties dialog box, click on the 'Validate' tab. Choose the 'Run custom validation script' option and click the 'Edit' button.
Type the following code into the editor: if (event.value) { this.getField("text 2").value = event.value; this.getField("text 3").value = event.value; }
Click 'OK' to close the JavaScript editor, then close the Properties window. Exit form editing mode and type a value into the source field to verify the target fields update automatically.

Create and Manage PDF Forms with WPS Office
WPS Office features a comprehensive PDF toolset that allows you to easily edit, fill, and manage interactive PDF forms. Whether you need to input data or modify form structures, WPS PDF offers a smooth and efficient experience.
- 1. Open WPS PDF: Launch WPS Office and open your PDF file using the built-in WPS PDF tool.
- 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to view the available interactive form tools.
- 3. Edit or Fill Fields: Click on the existing text fields to fill in your data, or use the editing tools to add new fields to the page.
- 4. Save the Document: Click the 'Save' icon to ensure all your form data and structural changes are securely stored in the PDF.

Frequently Asked Questions
Can I link PDF form fields without using JavaScript?
Yes, if you give multiple text fields the exact same name, they will mirror each other's content automatically without any code. However, this locks them together, meaning they cannot be edited independently afterwards.
Why is my validation script not working in the PDF form?
The most common reason a script fails is mismatched field names. Ensure that the field names written in your JavaScript code exactly match the names of your form fields, including exact capitalization and spacing.
Does using the validation script make the target fields read-only?
No, using the validation event script only pushes the initial value to the target fields. The target fields remain fully and independently editable if the user decides to change their contents later.
How do I find the exact name of a PDF form field?
In your PDF editor's form editing mode, double-click the field to open its Properties dialog. The exact field name will be displayed at the top of the window or under the General tab.




