How to Use Checkboxes to Show or Hide PDF Form Fields in Acrobat
Question details
Control the visibility or availability of groups of PDF form fields depending on whether a specific checkbox is selected.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form where different users must complete different sections depending on their choices.
- Observed behavior
- The user needs a method to dynamically change the display properties (visible, hidden, or read-only) of related form sections when a checkbox is toggled.
Ensure you have Adobe Acrobat Pro or an advanced PDF editor installed, as standard PDF readers do not support adding JavaScript actions to form fields.
Use Acrobat JavaScript on Checkbox Mouse Up Action
Add a JavaScript code to the checkbox's action settings to automatically change the display properties of target form fields when checked or unchecked.
By utilizing the Mouse Up or Validate actions within a checkbox's properties, you can execute a script that detects the checkbox state. Based on this state, you can instruct Acrobat to set other specific fields to be visible, hidden, or read-only.
Launch Adobe Acrobat, open your PDF document, and select 'Prepare Form' from the Tools menu.
Right-click the checkbox you want to act as the trigger, select 'Properties' from the context menu, and click on the 'Actions' tab.
In the 'Select Trigger' dropdown, choose 'Mouse Up'. In the 'Select Action' dropdown, choose 'Run a JavaScript', and then click the 'Add' button.
Type the required JavaScript code in the editor. For example: if(event.target.value != 'Off') { this.getField('TargetField').display = display.visible; } else { this.getField('TargetField').display = display.hidden; } Then click 'OK' and close the properties window.

Manage and Edit PDF Forms Seamlessly with WPS Office
While adding complex JavaScript to PDFs requires specialized software, WPS Office provides a robust, lightweight PDF editor that allows you to effortlessly view, fill, and manage interactive PDF forms for your daily document workflows.
- 1. Open Your PDF in WPS: Launch WPS Office and open your interactive PDF form document.
- 2. Fill the Interactive Fields: Click directly on the checkboxes, text fields, or dropdowns to fill in the required information.
- 3. Save the Document: Click the 'Save' icon or press Ctrl+S to preserve your form selections securely.

Frequently Asked Questions
Can I hide PDF form fields without using JavaScript?
You can manually set a field's default property to 'Hidden' in the field's properties panel. However, to dynamically show or hide fields based on user interaction (like clicking a checkbox), Acrobat JavaScript is required.
What is the difference between display.hidden and display.readOnly?
The 'display.hidden' property completely removes the field from the user's view and it cannot be interacted with. The 'display.readOnly' property keeps the field visible on the page, but the user cannot alter its contents.
Will this checkbox JavaScript work in web browser PDF viewers?
Most built-in web browser PDF viewers (like Chrome or Edge) have very limited support for Acrobat JavaScript. For the dynamic form fields to work correctly, users should open the form in a dedicated desktop PDF application.




