How to Combine Multiple PDF Form Fields into a Summary Field
Question details
The user wants to collect multiline text from multiple form fields distributed across several PDF pages and display all the gathered text in a single summary form field.

- Product
- PDF Editor
- Device & OS
- not provided
- Scenario
- Creating or editing a complex PDF form that requires an aggregated summary section to display information inputted earlier in the document.
- Observed behavior
- The goal is to automatically display combined information with appropriate line breaks in a designated summary field based on user input from other source fields.
Ensure your PDF editing software supports form field calculation scripts and that all source fields are uniquely and clearly named before setting up the summary field.
Combine Form Fields Using a Custom Calculation Script
Use a custom JavaScript calculation script in the summary field's properties to concatenate the values of multiple source fields and separate them with line breaks.
To gather text from various fields into one place, you can leverage the built-in JavaScript engine found in advanced PDF editors. By writing a short calculation script, the summary field will dynamically update whenever the source fields change.
Open your PDF document in your PDF editor and navigate to the Form editing tab to make fields selectable.
Double-click the target summary field to open its Properties dialog box. Go to the 'Options' tab and check the 'Multi-line' option to ensure line breaks will display correctly.
Navigate to the 'Calculate' tab within the same Properties dialog box and select the 'Custom calculation script' option.
Click the 'Edit' button and enter a script that defines your variables and concatenates them. For example: var f1 = this.getField('Source1').valueAsString; var f2 = this.getField('Source2').valueAsString; event.value = f1 + '\n' + f2;
Click 'OK' to save the script, close the Properties dialog, and exit form editing mode to test entering text into the source fields.

Create and Calculate PDF Forms Effortlessly with WPS Office
WPS PDF provides robust form editing tools, including support for custom calculation scripts and multi-line text fields, allowing you to streamline data collection and document workflows seamlessly.
- 1. Open the PDF document: Launch WPS Office, open your PDF file, and navigate to the 'Form' tab.
- 2. Insert form fields: Select 'Text Field' from the toolbar to place your source fields and the target summary field onto the document.
- 3. Enable multi-line: Right-click the summary field, choose 'Properties', navigate to the 'Options' tab, and check 'Multi-line'.
- 4. Apply calculation script: Switch to the 'Calculate' tab in the Properties window, select 'Custom calculation script', and input your JavaScript concatenation code.

Frequently Asked Questions
Why is my summary field not displaying line breaks?
If your combined text appears on a single continuous line, you likely need to enable the multi-line option. Open the summary field's properties, navigate to the Options tab, and check the 'Multi-line' box. Additionally, ensure your calculation script correctly uses the newline character '\n' between field variables.
Can I combine text fields and dropdown menu selections in the summary field?
Yes, you can combine values from different types of form fields. The JavaScript calculation script uses the '.value' or '.valueAsString' property to extract the current text or user selection, which can then be concatenated together just like standard text fields.
Is JavaScript required to combine PDF form fields?
Yes, combining multiline text strings from different fields with specific formatting, such as line breaks, requires a custom JavaScript calculation script. The default mathematical calculations provided in standard PDF editors only support basic numerical operations like addition or multiplication.




