PDF Editing Issues

How to Automatically Create Sequential Numbers in a PDF Form

Elise WilliamsElise Williams Nov 5, 2026 869 views

Question details

The user needs to dynamically generate sequence labels (e.g., '1 of 15', '2 of 15') in a PDF shipping form based on a total quantity entered by a worker.

How to Automatically Create Sequential Numbers in a PDF Form
Product
Adobe Acrobat / PDF Form
Device & OS
not provided
Scenario
A worker fills out a shipping form and enters a total box quantity. The document should automatically populate the corresponding labels for each box.
Observed behavior
The user requires a method or script to link individual sequence fields to the total quantity field so they update automatically when the total is entered.
Before you start

Ensure you are using a professional PDF editor that supports interactive form creation and JavaScript calculations, and that you have already mapped out where your sequence labels will be placed on the document.

Solution 1Recommended

Use Custom JavaScript Calculations for Text Fields

Create a master input field for the total quantity, and set up individual text fields with custom calculation scripts to generate the sequential labels.

Interactive PDF forms can utilize JavaScript to combine fixed text (like the current sequence number) with variable data (like the total quantity entered by the user). By configuring the calculation properties of individual text fields, you can achieve automatic sequential numbering.

1
Create the Total Quantity Field

Open your PDF editor's form mode. Insert a Text Field where the worker will type the total number. Right-click the field, select Properties, and name the field exactly 'TotalQty'.

2
Insert Sequence Fields

Create separate Text Fields for each label you need to generate (e.g., for box 1, box 2, etc.). Name these fields uniquely, such as 'Label1', 'Label2', and so on.

3
Apply Custom Calculation Script

Right-click the first sequence field ('Label1') and select Properties. Navigate to the Calculate tab, select 'Custom calculation script', and click Edit.

4
Enter the JavaScript Code

Type the following script: event.value = '1 of ' + this.getField('TotalQty').value; and click OK. Repeat this process for 'Label2' changing the script to '2 of ', and continue for the rest of your sequence fields.

5
Test the Form

Exit form editing mode and type a number like '15' into the 'TotalQty' field. Press Enter or click outside the box to verify that the sequence labels instantly update to '1 of 15', '2 of 15', etc.

Use Custom JavaScript Calculations for Text Fields
Calculation Order: If the fields do not update correctly, check your form's calculation order. The 'TotalQty' field must be processed before the 'Label' fields calculate their values.
Powerful PDF Editor

Create and Manage Interactive PDF Forms with WPS Office

WPS Office includes a comprehensive PDF editor that makes it incredibly easy to design interactive forms, insert text fields, and manage properties without needing complex standalone software.

  1. 1. Open your PDF in WPS: Launch WPS Office, select the PDF tab, and open your existing document or start a new blank PDF.
  2. 2. Access the Form Tab: Click on the 'Form' tab on the top ribbon to reveal the interactive form controls.
  3. 3. Insert Text Fields: Select 'Text Field' and drag your cursor on the page to draw input boxes for your total quantity and sequence labels.
  4. 4. Customize Properties: Double-click the inserted text fields to open the Properties menu, where you can define names, formatting, and behavior.
Easily add interactive text fields, checkboxes, and drop-down lists.Seamlessly compatible with standard PDF form formats and Adobe Acrobat.Lightweight application with an intuitive, ribbon-style interface.Cost-effective solution with powerful built-in PDF tools.
microsoft office alternative - wps office

Frequently Asked Questions

Can I dynamically spawn new pages based on the total quantity entered?

Standard PDF forms do not natively support spawning new pages from templates simply by entering a number in a text field. This requires advanced document-level JavaScript and specific security permissions (often restricted to Acrobat Pro). It is recommended to pre-create the maximum number of fields or pages you might need.

Why isn't my sequence label updating when I type the total quantity?

This usually happens if the calculation order is incorrect or if the field names in your JavaScript do not exactly match the actual field names (remember that JavaScript is case-sensitive). Ensure 'TotalQty' matches the master input field name perfectly.

Can I do this without using JavaScript?

No, standard PDF forms require JavaScript to perform string concatenation (combining the fixed text '1 of ' with the dynamic total quantity). Without JavaScript, you would have to type the sequences manually.