PDF Editing Issues

Clear an Acrobat Checkbox When User Selects No in an Alert

Elise WilliamsElise Williams Nov 5, 2026 869 views

Question details

The user needs to automatically uncheck a selected PDF form checkbox in Adobe Acrobat Pro if a user clicks No in an alert confirmation box.

How to Clear an Acrobat Checkbox When User Selects No in an Alert Box
Product
Adobe Acrobat Pro 2017
Device & OS
not provided
Scenario
Developing or editing interactive PDF forms using JavaScript to validate user selections.
Observed behavior
The developer needs a script that resets the checkbox value to Off when the response to the app.alert function evaluates to 3, which represents No.
Before you start

Ensure you have access to edit the PDF form fields and that JavaScript execution is enabled in your PDF editor's preferences.

Solution 1Recommended

Use JavaScript to Reset the Checkbox Value

Add a custom JavaScript action to the checkbox properties to catch the alert response and reset the field.

In Adobe Acrobat, the app.alert method can return different values based on the button clicked by the user. A return value of 3 represents a 'No' selection. By checking this value, you can immediately set the event target value to 'Off', which clears the checkbox.

1
Enter form editing mode

Open your PDF form in Adobe Acrobat Pro and enter 'Prepare Form' mode from the tools pane.

2
Access checkbox properties

Right-click the specific checkbox you want to configure and select 'Properties' from the context menu.

3
Add a JavaScript action

Navigate to the 'Actions' tab. Select 'Mouse Up' as the trigger, choose 'Run a JavaScript' from the action dropdown menu, and click the 'Add' button.

4
Input the validation script

In the JavaScript Editor window, paste the following script: if (app.alert('Confirm selection?', 2, 2) == 3) event.target.value = 'Off'; Then click 'OK' to save.

5
Test the checkbox

Close the properties window and exit 'Prepare Form' mode. Click the checkbox; when the alert appears, select 'No' to verify that the checkmark is removed.

Use JavaScript to Reset the Checkbox Value
Understanding the Alert Parameters: In app.alert('Message', 2, 2), the first '2' denotes a question mark icon, and the second '2' specifies that the alert should display 'Yes/No' buttons.

Manage and Edit PDF Forms with WPS Office

If you are looking for an efficient way to manage interactive PDFs, WPS Office provides a powerful PDF editor. It supports viewing, filling, and editing PDF forms seamlessly across Windows, Mac, and mobile devices.

  1. 1. Open your PDF in WPS: Launch WPS Office and click on the 'PDF' tab to open your interactive document.
  2. 2. Access form tools: Navigate to the 'Form' tab in the top ribbon to view available interactive form tools and highlighters.
  3. 3. Edit or fill the document: Click directly on the checkboxes or text fields to interact with them, or use the editing tools to modify the document layout.
Easily interact with and fill out text fields, checkboxes, and interactive elements in PDF documents.Highly compatible with standard PDF forms originally created in Adobe Acrobat or Microsoft Word.Lightweight software that loads large PDF files instantly without consuming heavy system resources.
microsoft office alternative - wps office

Frequently Asked Questions

Why doesn't the checkbox clear when I set the value to an empty string?

For standard PDF checkboxes, the unchecked state is typically represented by the specific export string 'Off', not an empty string (''). Setting the target value strictly to 'Off' ensures it clears properly.

Can I customize the text message in the alert box?

Yes, you can replace 'Confirm selection?' in the app.alert() function with any text string you want to display to the user, such as 'Are you sure you want to enable this option?'.

What happens if the user clicks 'Yes' in the alert box?

If the user clicks 'Yes', the app.alert function returns 4. Since the script only looks for a return value of 3 (which means 'No'), clicking 'Yes' bypasses the script and leaves the checkbox selected.

How do I test the JavaScript after adding it to the form field?

To test the script, you must exit 'Prepare Form' mode and click on the checkbox using the standard Hand or Select tool. The alert should pop up, and clicking 'No' should immediately uncheck the box.