Automatically Fill Multiple Acrobat Form Fields from One Field
Question details
Populate several PDF form fields using a single document-number field.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- A PDF form contains a document-number field and related fields for the date, full document name, and summary.
- Observed behavior
- Entering a document number should fill the related fields with the corresponding information.
List the document numbers and their corresponding dates, names, and summaries, or identify a predictable rule for generating them. Open the PDF in Acrobat and check that you can edit its form fields.
Use custom calculation scripts to fill the related fields
Use this method when each document number has known values or follows a predictable rule.
Each destination field can use a custom calculation script that reads the document-number field and assigns a result to event.value. The example below uses a small lookup table; replace its sample entries with your own data.
Open the PDF in Acrobat and select All tools > Prepare a form. Create a text field named DocumentNumber and separate text fields for the date, document name, and summary.
In Prepare a form, double-click the date field. In Properties, select Calculate, choose Custom calculation script, and click Edit.
Paste this example into the script editor, then click OK: var records = {"DOC-001": {date: "2025-01-15", name: "Sample Document", summary: "Sample summary"}, "DOC-002": {date: "2025-02-20", name: "Second Document", summary: "Second summary"}}; var key = this.getField("DocumentNumber").valueAsString; event.value = records[key] ? records[key].date : "";
Open Properties > Calculate > Custom calculation script > Edit for the document-name and summary fields. Paste the same lookup script into each, changing records[key].date to records[key].name for the name field and records[key].summary for the summary field.
Select Preview in Prepare a form, enter a document number such as DOC-001, and move out of the field. Confirm that all three destination fields display the matching values, then save the PDF.

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 Microsoft Office files. Open existing files to make migration easier; Acrobat-specific JavaScript form automation is not guaranteed to work in WPS.

Frequently Asked Questions
Why are the destination fields blank after I enter a document number?
Check that the source field is named DocumentNumber and that the entered value exactly matches a key in the lookup table. Also check each destination field under Properties > Calculate for the correct script.
Can I generate the values instead of maintaining a lookup table?
Yes. If the document number contains enough information to derive a value reliably, use a custom calculation script under the destination field's Properties > Calculate tab to apply that rule.
Do I need a separate script for every destination field?
With the approach shown here, each destination field has its own custom calculation script. The scripts can use the same lookup data, but each must assign the appropriate date, name, or summary to event.value.
What if calculations do not run in Acrobat?
Check Acrobat's form preferences to make sure automatic field-value calculation is enabled, and verify that JavaScript is permitted. Test the form in Acrobat because other PDF viewers may not support the same scripts.




