PDF Editing Issues

How to Auto-Populate a PDF Field and Allow Manual Editing

Steven ParkerSteven Parker Oct 28, 2026 869 views

Question details

The user wants to automatically populate a PDF form field with data from three other fields while retaining the ability for users to manually edit the resulting value.

How to Auto-Populate a PDF Field and Allow Manual Editing
Product
PDF
Device & OS
not provided
Scenario
Creating an interactive PDF form where a specific field combines data from multiple source fields but needs to remain editable for user corrections.
Observed behavior
When using a standard calculation script, the populated field resets and overwrites any manual edits whenever the user clicks away or leaves the field.
Before you start

Ensure you have a PDF editor that supports form creation and custom JavaScript actions, and take note of the exact names of the form fields you want to combine.

Solution 1Recommended

Use a Button Script to Populate the Field

By assigning a JavaScript action to a button instead of using a calculation script, you can populate the field on demand, which prevents the form from continuously overwriting manual edits.

A standard calculation script runs automatically every time the PDF form updates, causing any manual changes to be instantly overwritten by the script's output. Tying the script to a button's 'Mouse Up' event ensures the data is only populated when the user intentionally clicks the button.

1
Create a button field

Open your PDF form editor, navigate to the form creation tools, and insert a new Button field into your document.

2
Access button properties

Right-click the newly created button, select 'Properties', and navigate to the 'Actions' tab.

3
Set the trigger action

In the Actions tab, set the 'Select Trigger' option to 'Mouse Up' and the 'Select Action' option to 'Run a JavaScript', then click 'Add'.

4
Enter the JavaScript code

In the JavaScript editor, input the concatenation script. For example: this.getField("Field4").value = this.getField("Field1").valueAsString + " " + this.getField("Field2").valueAsString + " " + this.getField("Field3").valueAsString;

5
Test the form

Save your changes and switch to the hand/preview tool. Click the button to populate the target field, then click inside the field to manually edit the text and verify it does not reset.

Use a Button Script to Populate the Field
Field Naming Customization: Remember to replace "Field1", "Field2", "Field3", and "Field4" in the script with the exact field names used in your specific PDF document.
Professional PDF Editor

Create and Manage Interactive PDF Forms with WPS Office

WPS Office provides powerful PDF editing capabilities, making it easy to design interactive forms, insert text fields, add action buttons, and customize PDF documents for professional use.

  1. 1. Open WPS Office: Launch WPS Office and navigate to the PDF tab to open your document.
  2. 2. Access Form Tools: Click on the 'Form' tab in the top ribbon to access tools for adding text fields, buttons, and other interactive elements.
  3. 3. Customize and Save: Configure your field properties, adjust the layout, and save your interactive PDF document securely.
Easily create, edit, and fill interactive PDF formsSupport for inserting buttons, text fields, and checkboxesFully compatible with standard PDF formats and Adobe Acrobat formsLightweight, fast, and features a user-friendly interface
microsoft office alternative - wps office

Frequently Asked Questions

Why does my calculated PDF field reset when I click away?

If a field uses a built-in calculation script, the PDF viewer automatically recalculates the value whenever the form updates or loses focus. This continuous recalculation overwrites any manual input.

Can I use this script to combine text and numbers?

Yes. By using the '.valueAsString' property in your JavaScript, both text and numerical values from the source fields are treated as strings and can be concatenated without calculation errors.

Do I have to use a button to trigger the script?

While a button is the most user-friendly and reliable way to let the user decide when to populate the field, you could alternatively tie the script to a checkbox or another specific event that does not trigger continuously.