PDF Editing Issues

How to Hide an Unchecked Checkbox and Label After PDF Form Submission

Ayan MasoodAyan Masood Nov 5, 2026 868 views

Question details

The user wants to configure a PDF form so that if a checkbox is left unchecked, both the checkbox and its associated text label become hidden upon form submission.

How to Hide an Unchecked Checkbox and Label After PDF Form Submission
Product
PDF Editor
Device & OS
not provided
Scenario
Submitting a completed interactive PDF form where unselected options need to be hidden to clean up the final document's appearance.
Observed behavior
The user needs to implement a JavaScript action triggered by the submission event to dynamically change the display properties of specific form fields based on their checked state.
Before you start

Ensure you know the exact field names of your checkbox and the text field acting as its label. Your PDF editor must support custom JavaScript for interactive form elements.

Solution 1Recommended

Add a JavaScript Action to the Submit Button

Configure the form's submit button to run a script that verifies the checkbox's state and hides it along with its label if it remains unchecked.

This method uses standard PDF JavaScript to alter field display properties. By attaching the script to the 'Mouse Up' action of your submit button, the PDF will instantly hide the specified fields right before the form data is processed.

1
Open Submit Button Properties

Right-click the submit button in your PDF form and select 'Properties' from the context menu.

2
Configure the Action Trigger

Navigate to the 'Actions' tab. Select 'Mouse Up' in the 'Select Trigger' dropdown, choose 'Run a JavaScript' from the 'Select Action' menu, and click 'Add'.

3
Enter the JavaScript Code

In the JavaScript editor, input the following code: if (this.getField("Checkbox1").valueAsString == "Off") { this.getField("Checkbox1").display = display.hidden; this.getField("Text1").display = display.hidden; }

4
Update Field Names

Replace "Checkbox1" with the actual name of your checkbox field and "Text1" with the name of the text field that serves as your label. Click 'OK' and close the properties window to save your changes.

Add a JavaScript Action to the Submit Button
Label Format Requirement: For this script to work, the text label must be created as an interactive 'Text Field' in the form, not as standard static PDF text. Static text cannot be hidden via JavaScript.
Efficient PDF Form Editing

Edit and Manage Interactive PDF Forms Easily with WPS Office

WPS Office offers a comprehensive suite of PDF tools, allowing you to seamlessly create, edit, and fill interactive PDF forms, including managing field properties and optimizing form layouts.

  1. 1. Open Your PDF in WPS: Launch WPS Office and open your PDF form using the built-in PDF editor.
  2. 2. Access the Form Tab: Navigate to the 'Form' tab on the top ribbon to access tools for checkboxes, text fields, and buttons.
  3. 3. Modify Form Controls: Double-click any form field to instantly adjust its appearance, properties, and actions to suit your form submission needs.
Easily create and fill interactive PDF forms with checkboxes and text fields.Highly compatible with Adobe Acrobat PDF formats and form structures.Intuitive user interface for managing form elements without complex coding.Lightweight software that runs smoothly on all major operating systems.
QA img-9

Frequently Asked Questions

Why isn't the script hiding my text label?

This commonly occurs if the label is written as static text on the PDF rather than being formatted as an interactive text form field. Ensure you create a specific 'Text Field' for the label so the JavaScript can target and hide it.

Can I hide multiple checkboxes at once?

Yes. You can extend the JavaScript by adding additional 'if' statements or using a loop to check multiple checkboxes, ensuring you reference the exact field name for each checkbox and corresponding label.

How do I make the fields visible again if the user needs to correct the form?

You will need to trigger a reset script. You can add a 'Reset Form' button with a JavaScript action that sets the display property back to visible: this.getField("Checkbox1").display = display.visible;