PDF Editing Issues

How to List PDF Field Names with Widget Suffixes in Acrobat JavaScript

Huma Ashraf ChHuma Ashraf Ch Nov 2, 2026 869 views

Question details

The user needs to list PDF form field names that have widget suffixes (like #0, #1) and identify which page contains each widget using Acrobat JavaScript.

How to List PDF Field Names with Widget Suffixes in Acrobat JavaScript
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Writing JavaScript to inspect or list duplicated form fields (widgets) and their corresponding page locations within a PDF document.
Observed behavior
Acrobat displays copied fields with #0 or #1 suffixes, creating confusion on how to properly reference the field names and locate their pages programmatically.
Before you start

Ensure you have access to the JavaScript console in your PDF editor and that your document contains the duplicated form fields you want to inspect.

Solution 1Recommended

Use the Base Field Name with getField() and Inspect Properties

Reference the form field using its base name instead of the display suffix, then use the page property or getArray() method to locate the widgets.

Acrobat uses suffixes like #0 and #1 merely as a display notation to differentiate separate widgets that share the exact same field name. These are not literal parts of the field name in JavaScript. You must use the base name to interact with the field object programmatically.

1
Open the JavaScript Console

Open your PDF document and launch the JavaScript console (Ctrl+J on Windows or Cmd+J on Mac in Acrobat).

2
Target the Base Field Name

Target the base field name using the getField method, omitting the # suffix. For example: var f = this.getField('OriginalField');

3
Query the Page Property

To find which pages contain these widgets, query the page property by executing: console.println(f.page); This will return an array of page numbers (zero-based index) where the widgets reside.

4
Inspect Individual Widgets

If you need to inspect individual widgets and their specific locations, use the getArray() method on the field object to iterate through each instance.

Use the Base Field Name with getField() and Inspect Properties
Internal Field Naming: While the user interface shows '#0', the actual unique internal widget references are typically formatted with a period, such as 'Textfield.0' and 'Textfield.1'.
Manage PDF Forms Easily

Edit and Manage PDF Form Fields with WPS Office

Instead of relying entirely on JavaScript console commands to track field locations, WPS Office provides an intuitive visual interface to manage PDF form fields, view their properties, and organize duplicated widgets seamlessly.

  1. 1. Open Your PDF Form: Launch WPS Office and open your PDF document containing the interactive forms.
  2. 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon menu to access the comprehensive PDF form editing tools.
  3. 3. View Field Properties: Double-click any form field or click 'Form Properties' to view its specific attributes, including its base name and page location.
  4. 4. Manage Duplicates Visually: Use the visual form panel to locate all widgets on the current page and adjust their names without needing to write custom JavaScript arrays.
Visual form field manager requiring no coding or JavaScript console experience.Easily duplicate, align, and track form fields across multiple pages.Fully compatible with standard PDF forms and Adobe Acrobat formats.Lightweight, fast, and feature-rich PDF editing experience.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my PDF field name have a #0 or #1 suffix?

Acrobat automatically adds these #0 or #1 suffixes as a visual display notation when you copy and paste a form field. It indicates that multiple unique widgets share the exact same base field name and will display the identical user input.

How do I get the page number of a specific PDF widget using JavaScript?

You can retrieve the page number by querying the page property of the field object. Using this.getField('FieldName').page in the console will return a zero-based array of the page numbers where the associated widgets are located.

What is the difference between getField() and getArray() in Acrobat PDF scripting?

The getField() method retrieves the main field object based on its base name, representing all widgets sharing that exact name. The getArray() method is used on that field object to return an array of the individual widgets, allowing you to inspect each specific visual instance separately.

Can I remove or change the #0 suffix in a PDF form field?

You cannot directly edit or remove the #0 suffix because it is solely a UI indicator for duplicated fields. To make the fields independent so they do not share data or display suffixes, you must rename the base field name to be completely unique for each widget.