PDF Editing Issues

How to Copy PDF Form Values Between Fields Using a Checkbox

Anum MushtaqAnum Mushtaq Nov 10, 2026 869 views

Question details

The user wants to configure a checkbox in a PDF form that automatically copies input data from one section to corresponding fields in another section.

How to Copy PDF Form Values Between Fields Using a Checkbox
Product
PDF
Device & OS
not provided
Scenario
Creating an interactive PDF form where users need to enter repeating information, such as mirroring a billing address to a shipping address section.
Observed behavior
Setting up an automated mechanism using form field actions to mirror data across matching fields when a specific checkbox is ticked.
Before you start

Ensure you have a PDF editor that supports interactive form creation and JavaScript actions. Verify and write down the exact names of the source and destination text fields you intend to link before adding the script.

Solution 1Recommended

Use a JavaScript Action on the Checkbox to Copy Values

Add a custom JavaScript script triggered by a Mouse Up action on the checkbox to instantly copy the contents of designated source fields to their corresponding destination fields.

This method utilizes basic PDF JavaScript to retrieve values from the filled fields and duplicate them into the target fields whenever the user clicks the checkbox.

To ensure the script functions properly, the field names referenced in the JavaScript code must exactly match the field names assigned in your PDF form's properties.

1
Open Checkbox Properties

Enter the form editing mode of your PDF application. Right-click the checkbox you want to use as the trigger (e.g., 'Same as above') and select 'Properties'.

2
Set the Action Trigger

Navigate to the 'Actions' tab within the Properties window. From the 'Select Trigger' dropdown menu, choose 'Mouse Up'.

3
Add the JavaScript Action

In the 'Select Action' dropdown, choose 'Run a JavaScript', and then click the 'Add' button.

4
Insert the Script

In the JavaScript Editor window, paste the following code: if (event.target.value != "Off") { this.getField("Email2").value = this.getField("Email1").value; this.getField("Phone2").value = this.getField("Phone1").value; } Update the field names ('Email1', 'Email2', etc.) to match those used in your specific document.

5
Save and Test

Click 'OK' to save the script, then close the Properties window. Exit form editing mode to test the checkbox by typing into the source fields and clicking the checkbox to watch the values copy over.

Use a JavaScript Action on the Checkbox to Copy Values
Handling Unchecked States: If you want the destination fields to clear when the user unchecks the box, you can add an 'else' block to your JavaScript that sets the destination field values to an empty string ("").
Powerful PDF Form Management

Manage and Fill Interactive PDF Forms with WPS Office

WPS Office provides a comprehensive and easy-to-use PDF editor that allows you to seamlessly interact with complex PDF forms, including those utilizing JavaScript checkboxes. Experience smooth form filling and editing across all your devices.

  1. 1. Open Your PDF Form: Launch WPS Office and open your interactive PDF document containing the form fields.
  2. 2. Fill in the Details: Click on the text fields to enter your contact information, addresses, or any other required data.
  3. 3. Interact with Checkboxes: Click the automated checkboxes to trigger form scripts. WPS PDF will automatically execute standard form JavaScript, instantly copying the values to the corresponding sections.
  4. 4. Save or Export: Once the form is completely filled out, click 'Save' or use the 'Export' feature to share the completed document securely.
Effortlessly fill and interact with advanced PDF forms, including scripted checkboxes and dropdowns.High compatibility with Microsoft Word, Excel, PowerPoint, and standard Adobe PDF formats.Lightweight, fast-loading office suite that saves system resources while delivering professional tools.Add electronic signatures and secure your PDF documents with ease.
microsoft office alternative - wps office

Frequently Asked Questions

Why is the JavaScript not copying the values when I click the checkbox?

This usually happens if the field names in the script do not perfectly match the actual field names in the PDF form properties. Field names are case-sensitive. Additionally, verify that the action is set to 'Mouse Up' rather than just 'Mouse Enter'.

Can I use this method to copy data from dropdowns instead of text fields?

Yes. The 'this.getField().value' script works for dropdowns as well, provided the destination text field is capable of receiving the string value selected from the dropdown.

Is it possible to copy values across multiple pages in the same PDF?

Absolutely. The getField script searches the entire document for the specified field name. As long as the destination field exists anywhere in the same PDF document, the value will be copied successfully regardless of the page.

What happens if a user alters the copied data in the destination field?

By default, the user can manually edit the destination field after the checkbox script copies the initial data. If you want to prevent them from editing the copied data, you can add a line of JavaScript to set the destination field's 'readonly' property to true when the checkbox is ticked.