PDF Editing Issues

Automatically Combine Name Fields in an Adobe Acrobat Form

Jason MillerJason Miller Nov 24, 2026 869 views

Question details

Create a calculated Full Name field that combines separate name fields automatically.

Automatically Combine Name Fields in an Adobe Acrobat Form
Product
Adobe Acrobat
Device & OS
not provided
Scenario
A PDF form collects a first name, middle initial, last name, and optional suffix in separate fields.
Observed behavior
The Full Name field should update when a source field changes, adding spaces and a comma before the suffix only when needed.
Before you start

Open the PDF in Adobe Acrobat and confirm that the first name, middle initial, last name, suffix, and Full Name fields exist. Check their exact field names in Prepare a form; the script must use those names.

Solution 1Recommended

Add a custom calculation script to the Full Name field

Use this method to update the Full Name field automatically as users complete the separate name fields.

1
Open the form editor

In Acrobat, open the PDF and select All tools > Prepare a form. Locate the Full Name text field.

2
Open the calculation settings

Double-click the Full Name field to open its properties. Select the Calculate tab, choose Custom calculation script, and click Edit.

3
Enter the script

Paste this script into the editor. Replace FirstName, MiddleInitial, LastName, and Suffix with the exact names of your source fields if they differ: function fieldText(name) { var field = this.getField(name); return field ? String(field.value).replace(/^\s+|\s+$/g, "") : ""; } var first = fieldText("FirstName"); var middle = fieldText("MiddleInitial"); var last = fieldText("LastName"); var suffix = fieldText("Suffix"); var parts = []; if (first) parts.push(first); if (middle) parts.push(middle); if (last) parts.push(last); var fullName = parts.join(" "); if (suffix) fullName += (fullName ? ", " : "") + suffix; event.value = fullName;

4
Save and test the form

Close the script editor and field properties, save the PDF, and exit form editing. Enter and change values in the name fields to confirm that Full Name updates, including when the middle initial or suffix is blank.

Add a custom calculation script to the Full Name field
Check calculation support: The script relies on Acrobat JavaScript. Other PDF viewers may not support calculated fields or may handle them differently.
Free Microsoft Office alternative

Use WPS Office for Everyday PDF and Document Work

WPS Office is a free, lightweight alternative with a familiar interface for working with PDFs and Office files. Its format compatibility makes it easy to move existing documents into WPS, but it does not replace Acrobat's custom calculation script for this form.

Open and work with PDF documents alongside other office filesCompatible with Microsoft Office formats including DOCX, XLSX, and PPTXUse a familiar interface for a smoother transition from Microsoft OfficeAccess everyday office tools in a lightweight suite
microsoft office alternative - wps office

Frequently Asked Questions

Where do I put the name-combining script in Acrobat?

In Prepare a form, open the Full Name field properties, select Calculate, and choose Custom calculation script. Click Edit and paste the script there, not in one of the source fields.

What happens if the middle initial or suffix is blank?

The script skips blank fields. It joins the available name parts with spaces and adds a comma before the suffix only when both the suffix and another name part are present.

Why is the Full Name field not updating?

Check that the names in getField match the actual field names in Prepare a form. Also confirm that JavaScript and automatic form calculations are enabled in Acrobat's preferences, and test the PDF in Acrobat rather than a viewer with limited JavaScript support.

Will the script add a period after the middle initial?

No. The script uses the middle initial as entered. Include a period in the source field if you want it to appear in the Full Name.