How to Add Automatic Sequential Numbering to Acrobat PDF Form Fields
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.

- 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.
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').
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.
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.
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.
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)); }
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.

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. Download and Install: Download WPS Office and open the built-in WPS PDF application.
- 2. Open Your PDF Form: Click 'Open' to import the PDF document that contains your interactive form fields.
- 3. Interact with the Form: Navigate to the 'Form' tab to actively fill data, edit text, or modify the document layout as needed.
- 4. Save and Export: Save your completed document locally or share the finalized PDF directly from the software.

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.




