How to Copy Checked PDF Form Fields into a Summary Text Field
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.

- 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.
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.
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.
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.
Navigate to the 'Calculate' tab in the same field properties window. Select the 'Custom calculation script' option and click the 'Edit' button.
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;
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.

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. Open PDF in WPS Office: Launch WPS Office and open your PDF document containing the interactive form fields.
- 2. Access the Form Tab: Navigate to the 'Form' tab on the top ribbon to access the interactive form controls and editing tools.
- 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.

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".




