How to Combine Multiple PDF Form Fields into One Field
Question details
The user needs to merge text from several source PDF form fields into a single destination field.

- Product
- Device & OS
- not provided
- Scenario
- Creating or editing a PDF form where data from multiple fields needs to be consolidated and displayed on another page or in a single output box.
- Observed behavior
- The user is looking for the correct procedure and script logic to read source fields and join their values together with appropriate spacing or line breaks.
Ensure you have the exact names of the source PDF form fields you want to combine and that your PDF editor supports JavaScript for custom field calculations.
Create a Calculated Text Field with a Custom Script
Use a custom JavaScript calculation in the destination field to read, format, and combine the values of the source fields.
By setting up a calculation script, the destination field can automatically update its content whenever the user inputs data into the source fields. You can format the combined text using spaces, carriage returns, or line feeds.
Right-click the destination text field where you want the combined text to appear and select 'Properties' from the context menu.
In the Text Field Properties dialog box, click on the 'Calculate' tab to view the calculation options.
Select the 'Custom calculation script' radio button, then click the 'Edit' button to open the JavaScript editor.
Input the script to retrieve and join the source fields. For example: `event.value = this.getField('Field1').value + '\n' + this.getField('Field2').value;` to separate them with a line break.
Click 'OK' to save your script, then click 'Close' on the Properties window. Enter text into the source fields to verify that the destination field updates correctly.

Edit and Fill PDF Forms Seamlessly with WPS PDF
WPS Office includes a robust PDF editor that allows you to view, fill, and manage PDF forms easily. Handle all your document workflows in one lightweight application.
- 1. Download WPS Office: Download and install the free version of WPS Office on your computer.
- 2. Open Your PDF Form: Launch WPS PDF and open the interactive PDF form you need to work on.
- 3. Fill the Form Fields: Click on the highlighted form fields to enter your information effortlessly.
- 4. Save and Export: Once completed, click the 'Save' icon to preserve your filled data, or export the document as needed.

Frequently Asked Questions
Can I separate combined form fields with spaces instead of line breaks?
Yes, in your custom calculation script, you can concatenate the field values using a space character (e.g., `+ " " +`) instead of a newline character (`\n`).
Why is my calculated field not showing line breaks?
For line breaks to render correctly in the destination field, you must ensure that the 'Multi-line' option is checked in the 'Options' tab of the text field's properties.
Why isn't the destination field updating when I change the source fields?
This is often due to the form field calculation order. You need to ensure that the destination field is calculated after the source fields. Check the calculation order settings in your PDF form editor.




