PDF Editing Issues

How to Copy Checked PDF Form Fields into a Summary Text Field

Aamir Naveed AkramAamir Naveed Akram Nov 5, 2026 868 views

Question details

The user wants to use JavaScript in a PDF form to collect the text from selected checkboxes and display the compiled text into a single multiline summary field.

How to Copy Checked PDF Form Fields into a Summary Text Field
Product
Adobe Acrobat / PDF Editors
Device & OS
not provided
Scenario
Creating dynamic PDF forms (such as to-do lists or priority summaries) where checking specific boxes compiles the corresponding text values into a main summary field automatically.
Observed behavior
Requires a custom calculation script to dynamically extract values from checked boxes and populate a destination multiline text field.
Before you start

Ensure that your PDF form fields are properly named using a consistent sequential pattern (e.g., Check1, Check2 and Text1, Text2) before applying the calculation script.

Solution 1Recommended

Use Custom Calculation Script for the Summary Field

Apply a JavaScript snippet to the summary field's calculate properties to automatically pull and list text from the checked boxes.

This method iterates through your checkbox and text field pairs. If a checkbox is checked (not 'Off'), it grabs the text from the corresponding text field and adds it to the summary box on a new line.

1
Enable the Multiline Property

Open the properties of your summary text field. Navigate to the 'Options' tab, and check the 'Multiline' option to ensure text can flow across multiple lines.

2
Add a Custom Calculation Script

Navigate to the 'Calculate' tab in the same field properties window. Select the 'Custom calculation script' option and click the 'Edit' button.

3
Insert the JavaScript Code

Paste the following script into the JavaScript editor: var total = ""; for (var i = 1; i <= 92; i++) { if (this.getField("Check" + i).valueAsString != "Off") { total += this.getField("Text" + i).valueAsString + "\n"; } } event.value = total;

4
Adjust Field Variables

Change the number '92' in the script to match the exact number of checkbox and text-field pairs in your specific PDF document. Click 'OK' to save the script and close the properties window.

Use Custom Calculation Script for the Summary Field
Alternative Button Action: If you prefer using a button to generate the summary manually instead of an automatic calculation, place the code in the button's 'Mouse Up' action and assign the final result to the destination field (e.g., this.getField('SummaryField').value = total;).

Create and Manage PDF Forms Easily with WPS Office

WPS Office provides a comprehensive PDF editor that allows you to easily fill out interactive forms, add text fields, and manage checkboxes without needing complex coding for everyday document tasks.

  1. 1. Open PDF in WPS Office: Launch WPS Office and open your PDF document containing the interactive form fields.
  2. 2. Access the Form Tab: Navigate to the 'Form' tab on the top ribbon to access the interactive form controls and editing tools.
  3. 3. Edit Form Properties: Double-click any text field or checkbox to open its properties, where you can easily define appearances, export values, and formatting.
Easily insert interactive text fields, checkboxes, and buttons into your PDFs.Highly compatible with standard Adobe PDF forms and interactive document formats.Lightweight, fast alternative to heavy PDF editing software.Cross-platform support for Windows, Mac, iOS, and Android devices.
microsoft office alternative - wps office

Frequently Asked Questions

Why is the summary text field cutting off the copied text?

If the copied text is cut off or appearing on a single continuous line, ensure that you have checked the 'Multiline' option in the summary text field's properties under the Options tab.

Do my checkboxes and text fields need specific names for the script to work?

Yes, the provided calculation script relies on sequential naming. Your checkboxes must be named sequentially (e.g., Check1, Check2) and the corresponding text fields must match that sequence (e.g., Text1, Text2).

How do I format the copied text with dashes instead of new lines?

To separate the text with dashes instead of new lines, modify the script's addition line to: total += this.getField("Text" + i).valueAsString + " - "; instead of using "\n".