How to Hide One Checkbox Widget with a Duplicate Field Name in PDF
Question details
The user needs to hide one specific checkbox in a PDF form without hiding other checkboxes that share the exact same field name.

- Product
- PDF Form Editors
- Device & OS
- not provided
- Scenario
- Editing or scripting PDF forms that contain multiple checkbox widgets sharing the same parent field name.
- Observed behavior
- Changing the parent field's display property automatically hides all checkboxes with that name, rather than addressing the single intended widget.
Ensure you have access to the PDF form's JavaScript editor or form field properties, and carefully note the exact field name and the order of the duplicate checkboxes.
Use JavaScript Dot Notation with Widget Index
Target the exact checkbox widget by appending its zero-based index to the field name using dot notation in your JavaScript code.
When multiple fields share the same name, they are treated as an array of widgets. You must specify the exact index of the widget to affect its individual properties without impacting the parent field.
Determine the zero-based index of the specific checkbox you want to hide among the duplicate fields (e.g., 0 for the first widget, 1 for the second).
Use the getField method combined with dot notation. For example, to hide the first widget of the 'Color' field, write: this.getField("Color.0").display = display.hidden;
Ensure you use a dot (e.g., Color.0) rather than a hash symbol (e.g., Color#0). Hash notation may fail to correctly address the individual widget.

Cover Checkbox with a Read-Only Overlay Field
Use a white, read-only field to visually cover the checkbox as a no-code alternative to hiding the widget programmatically.
Create and Manage PDF Forms with WPS Office
WPS Office offers a comprehensive set of PDF tools, allowing you to easily add, customize, and manage interactive form fields like checkboxes without complex coding.
- 1. Open the PDF: Launch WPS Office and open your PDF document containing the form fields.
- 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to access interactive field options.
- 3. Modify Checkboxes: Select the 'Check Box' tool to add new widgets or click existing ones to adjust their placement.
- 4. Adjust Properties: Double-click any form field to open its properties menu, where you can easily manage its appearance, name, and behavior.

Frequently Asked Questions
Why does changing the parent field display hide all checkboxes?
When multiple checkboxes share the exact same field name, they belong to the same parent field object. Changing the display property at the parent level cascades the setting to all associated widgets simultaneously.
What is a widget index in PDF forms?
A widget index is a numerical value assigned to individual instances of a form field that share the same name. It is typically zero-based, meaning the first widget is index 0, the second is 1, and so on.
Can I use different names for the checkboxes instead?
Yes, assigning unique field names to each checkbox is the simplest way to control them individually. However, keeping the same name is necessary when you want them to act as mutually exclusive options or share a single export value.




