PDF Editing Issues

How to Add Automatic Sequential Numbering to Acrobat PDF Form Fields

Chanuka GeekiyanageChanuka Geekiyanage Nov 3, 2026 869 views

Question details

The user needs to automatically populate a series of PDF form fields with sequential numbers based on the initial value entered in the first field.

How to Add Automatic Sequential Numbering to Acrobat PDF Form Fields
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Creating or editing a multi-field PDF form where subsequent fields (like rows of photo numbers) need to automatically increment from the starting number.
Observed behavior
A custom JavaScript validation script is required to trigger the automated numbering loop across the consecutive form fields.
Before you start

Ensure your PDF form already contains the necessary text fields and that they are named using a consistent, sequentially numbered format (e.g., 'PHOTO NUMBERRow1', 'PHOTO NUMBERRow2').

Solution 1Recommended

Apply Custom JavaScript Validation to the First Field

Use Adobe Acrobat's built-in JavaScript editor to add a custom validation script to your starting field, which will calculate and populate the rest of the sequence automatically.

By applying a custom validation script to the first field, the PDF form will automatically listen for your input. Once a starting number is entered, the script runs a loop to populate all the subsequent fields by incrementing the value. It also includes a rule to clear the fields if the first field is left blank.

1
Open Field Properties

Open your PDF form in Edit mode. Right-click the starting form field (e.g., the first 'Photo Number' field) and select 'Properties' from the context menu.

2
Navigate to the Validate Tab

In the Properties dialog box, click on the 'Validate' tab at the top. Select the 'Run custom validation script' radio button, then click the 'Edit' button.

3
Insert the JavaScript Code

In the JavaScript Editor, enter the following code: for (var i = 2; i <= 15; i++) { this.getField("PHOTO NUMBERRow" + i).value = (event.value == "") ? "" : (Number(event.value) + (i - 1)); }

4
Adjust Variables to Match Your Form

Modify 'PHOTO NUMBERRow' to exactly match the base name of your subsequent fields, and change '15' to the total number of sequential fields you have. Click 'OK' to save the script, then close the Properties window to test your form.

Apply Custom JavaScript Validation to the First Field
Script Automation: This script perfectly handles both adding the sequence and clearing subsequent fields instantly if the user deletes the entry in the first field.

Easily Manage and Edit PDF Forms with WPS Office

If you need a fast, intuitive, and highly compatible tool for managing PDF documents, WPS PDF offers a robust environment to view, edit, fill, and create PDF forms without complex setups.

  1. 1. Download and Install: Download WPS Office and open the built-in WPS PDF application.
  2. 2. Open Your PDF Form: Click 'Open' to import the PDF document that contains your interactive form fields.
  3. 3. Interact with the Form: Navigate to the 'Form' tab to actively fill data, edit text, or modify the document layout as needed.
  4. 4. Save and Export: Save your completed document locally or share the finalized PDF directly from the software.
Seamlessly fill and edit interactive PDF formsFully compatible with standard Adobe PDF formatsLightweight software with fast document loading speedsIncludes a rich suite of annotation and page management tools
microsoft office alternative - wps office

Frequently Asked Questions

Can I manually overwrite the populated values in the subsequent fields?

Yes, as long as the subsequent fields do not have the 'Read Only' property checked in their field properties. If you need manual override capabilities, ensure 'Read Only' remains unchecked.

Why is the script not updating my other form fields?

This usually happens due to a naming mismatch. Ensure that the base name in the script (e.g., "PHOTO NUMBERRow") exactly matches the text preceding the number in your actual field names, paying close attention to spaces and capitalization.

Will the sequential numbers clear if I delete the starting value?

Yes, the provided script includes a conditional operator `(event.value == "") ? ""` which checks if the first field is blank. If it is, it automatically clears the values in all subsequent fields in the loop.