How to Copy Checkbox and Radio Button Values Between PDF Form Sections
Question details
The user needs to automatically copy values from text fields, checkboxes, and radio buttons from one section of a PDF form to another, triggered by selecting a specific checkbox.

- Product
- Device & OS
- not provided
- Scenario
- Creating or editing a fillable PDF form where repetitive data entry can be avoided by linking sections dynamically.
- Observed behavior
- Form fields require a programmed trigger (JavaScript) to mirror selections and inputs dynamically when a checkbox is toggled.
Ensure you have a PDF editor that supports advanced form creation and JavaScript editing. Back up your original PDF file before adding or modifying any scripts.
Use PDF Form JavaScript to Copy Values
Attach a custom JavaScript action to the trigger checkbox to copy values from the source fields to the destination fields automatically.
To achieve dynamic copying between form sections, you must use Document JavaScript. This allows the PDF to listen for a 'Mouse Up' event on your trigger checkbox and execute a script that duplicates the data.
You will also need to define what happens when the checkbox is deselected, typically clearing the destination fields so they can be filled out manually.
Ensure all source and destination fields (text, checkboxes, radio buttons) have unique, identifiable names in your PDF editor (e.g., 'SourceText1' and 'DestText1').
Enter form editing mode, right-click the trigger checkbox (e.g., 'CopyDataCheck'), and select 'Properties'.
Navigate to the 'Actions' tab, select 'Mouse Up' as the trigger, choose 'Run a JavaScript' from the action dropdown menu, and click 'Add'.
Enter a script that checks the status of the checkbox. If checked, set the destination field values to match the source fields. For example: `if(event.target.value != "Off") { this.getField("DestText1").value = this.getField("SourceText1").value; }`.
Add an `else` statement to clear the destination fields if the user unchecks the box (e.g., `else { this.getField("DestText1").value = ""; }`), then save and test the form.

Manage and Edit Fillable PDFs with WPS Office
WPS PDF provides a comprehensive set of tools for viewing, filling, and managing PDF forms. Whether you are handling complex interactive forms or simply reviewing documents, WPS Office offers a seamless, lightweight, and highly compatible environment.
- 1. Open the PDF form: Launch WPS Office, select the 'PDF' tab, and open your interactive PDF form.
- 2. Fill and interact: Click directly into text fields, checkboxes, or radio buttons to input your data or trigger form actions.
- 3. Save your progress: Go to 'Menu' > 'Save As' to export your filled PDF form securely without losing any interactive data.

Frequently Asked Questions
Why are my copied radio buttons not displaying correctly?
Radio buttons require identical export values in both the source and destination groups. If the export value for 'Option 1' in the source group is 'Opt1', the destination group must also use 'Opt1' for that choice.
Can I copy form data without using JavaScript?
Yes, if you give two fields the exact same name in a PDF form, they will automatically mirror each other. However, this mirrors them permanently. If you need a checkbox to toggle the copying (e.g., 'Same as Billing Address'), you must use JavaScript.
How do I clear the destination fields when the box is unchecked?
In your JavaScript, add an `else` block that resets the values. For text fields, set the value to an empty string (""); for checkboxes and radio buttons, set their value to "Off".
Will JavaScript work in all PDF viewers?
Most modern, feature-rich desktop PDF editors support form JavaScript. However, some basic browser-based viewers or mobile PDF apps may not execute custom scripts, so it is best to test your form in standard PDF readers.




