How to Keep a Checked Checkbox Visible in an Acrobat JavaScript Form
Question details
The user needs to prevent the currently active checkbox from becoming hidden when a JavaScript action is triggered to hide multiple checkboxes in a PDF form.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- A user is writing JavaScript for a PDF form where checking an option triggers an event to hide other checkboxes.
- Observed behavior
- The script successfully hides the other checkboxes, but also unintentionally hides the active checkbox that was just selected, making it impossible for the user to uncheck it.
Ensure your PDF editor is in form preparation mode and that you have access to the document's JavaScript console or the specific field's action properties.
Append Visibility Property to the Checkbox Script
Fix the issue by explicitly telling the script to keep the active target visible immediately after the hiding action occurs.
When running a blanket command to hide fields, the event trigger itself might fall under the conditions of the script. Re-establishing the active checkbox's visibility at the very end of the script ensures it stays visible on the page.
Open your PDF document and activate the form editing mode (e.g., 'Prepare Form' in Acrobat).
Right-click the problematic checkbox field and select 'Properties'. Navigate to the 'Actions' tab.
Select the existing 'Run a JavaScript' action from the list and click 'Edit' to open the JavaScript editor window.
Scroll to the very bottom of your existing script and add the following line: event.target.display = display.visible;
Click 'OK' to save the script, close the properties dialog, exit form editing mode, and click the checkbox to verify it now remains visible.

Create and Edit Interactive PDF Forms Easily with WPS Office
If you are struggling with complex JavaScript in Adobe Acrobat, WPS Office provides a highly intuitive PDF editor to manage forms. You can add, adjust, and organize checkboxes and other interactive form fields with an easy-to-use interface.
- 1. Open Your PDF Document: Launch WPS Office and open your PDF file using the WPS PDF tool.
- 2. Navigate to the Form Tab: Click on the 'Form' tab in the top navigation ribbon to access interactive form controls.
- 3. Add Checkboxes: Select the 'Checkbox' icon, click anywhere on your document to place it, and adjust its properties effortlessly using the right-side panel.

Frequently Asked Questions
Why does event.target.display = display.visible fix the hidden checkbox issue?
The command 'event.target' specifically refers to the form field that triggered the script. By setting its display property to 'display.visible' at the end of the execution, it overrides any prior loop or command that may have hidden it along with the other fields.
Can I hide checkboxes without using JavaScript in a PDF?
While simple visibility conditions can sometimes be set through field properties or standard action triggers (like 'Show/Hide a field' in the Actions tab), complex logic involving multiple interacting checkboxes usually requires JavaScript.
How do I make checkboxes mutually exclusive like radio buttons?
To allow only one checkbox to be selected at a time, you must give all related checkboxes the exact same 'Name' in their properties, but assign them different 'Export Values' under the Options tab.




