PDF Editing Issues

Append PDF Form Field Values with JavaScript in Adobe Acrobat

Natalie TaylorNatalie Taylor Nov 18, 2026 868 views

Question details

Combine a work order number and a second value in a calculated PDF form field.

Append PDF Form Field Values with JavaScript in Adobe Acrobat
Product
Adobe Acrobat
Device & OS
not provided
Scenario
A PDF form needs to append the value of the BU1 field to the work order number in the WO#1 field.
Observed behavior
The result field should display the combined text when both source fields contain values and update when either value changes.
Before you start

Open the PDF in Adobe Acrobat and confirm that the source fields are named WO#1 and BU1 and that a separate text field exists for the result. Field names in the script must match the form exactly.

Solution 1Recommended

Add a custom calculation script to the result field

Use this method to combine the two field values automatically while preserving them as text.

1
Open the form editor

In Acrobat, open the PDF and select All tools > Prepare a form.

2
Open result field properties

Double-click the separate text field that should display the combined value, then open its Calculate tab.

3
Enter the script

Select Custom calculation script, click Edit, and enter: var WO1 = this.getField("WO#1").valueAsString; var BU1 = this.getField("BU1").valueAsString; event.value = (WO1 !== "" && BU1 !== "") ? WO1 + BU1 : "";

4
Test the calculation

Close the properties dialog, save the PDF, and use Preview in Prepare a form to enter values in WO#1 and BU1. Confirm that the result field displays them together.

Add a custom calculation script to the result field
Both values are required: The script leaves the result blank until both source fields contain a value. PDF viewers that do not support Acrobat form JavaScript may not run the calculation.
Free Microsoft Office alternative

Work with PDFs and Office files in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for working with PDFs and Office documents. Its format compatibility makes it easy to move everyday files between suites, but it does not fix Acrobat or guarantee support for Acrobat form JavaScript.

Open and work with PDF documents alongside office filesCompatible with Microsoft Office formats including DOCX and XLSXUse a familiar interface for everyday document tasksMove common files between office suites without starting over
microsoft office alternative - wps office

Frequently Asked Questions

Why does the result field stay blank?

The script displays a result only when both WO#1 and BU1 have values. Check the field names in Prepare a form and make sure they match the names in the script exactly.

How can I add a separator between the two values?

In the result field's Calculate > Custom calculation script editor, replace WO1 + BU1 with WO1 + "-" + BU1 to insert a hyphen.

Will the calculation work in every PDF viewer?

No. The viewer must support Acrobat form JavaScript. Test the saved PDF in the viewer your recipients will use.

Why does the script use valueAsString?

The valueAsString property reads each field as text, so the script concatenates the values rather than treating them as numbers.