Automatically Check a PDF Checkbox Based on Other Checkboxes in Adobe Acrobat
Question details
Automatically select checkbox B1 when A1.1, A1.2, and A1.3 are all selected.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- A PDF form needs a checkbox to reflect whether three other checkboxes are selected.
- Observed behavior
- B1 should be checked when all three source checkboxes are selected and cleared when any one is unchecked.
Open the PDF in Acrobat and confirm that the form fields are named exactly A1.1, A1.2, A1.3, and B1. The example assumes each name refers to a single checkbox widget.
Use a Document JavaScript and Mouse Up Actions to Update B1
Use this method to update B1 whenever a user clicks one of the three source checkboxes.
In Acrobat, search the tools for JavaScript and open Document JavaScripts. Add a script named checkAllA1, then enter this function in the editor: function checkAllA1() { this.getField("B1").checkThisBox(0, this.getField("A1.1").isBoxChecked(0) && this.getField("A1.2").isBoxChecked(0) && this.getField("A1.3").isBoxChecked(0) ); }
Open Prepare a Form, right-click A1.1, and choose Properties. On the Actions tab, select Mouse Up as the trigger and Run a JavaScript as the action. Click Add, enter checkAllA1();, and confirm. Repeat for A1.2 and A1.3.
Save the PDF, exit form editing, and click all three A1 checkboxes. Confirm that B1 becomes checked, then clear any one of the three and confirm that B1 is cleared.

Work With PDF Forms and Office Files in WPS Office
WPS Office is a free, lightweight Office alternative with a familiar interface for working with PDFs and Microsoft Office files. Open existing files to continue routine document work, but use Acrobat to configure and test this checkbox JavaScript.

Frequently Asked Questions
Will B1 be unchecked if I clear one of the source checkboxes?
Yes. Each Mouse Up action calls checkAllA1(), which checks all three source fields and clears B1 if any one is unchecked.
Where do I add the JavaScript for each checkbox?
In Prepare a Form, open the source checkbox's Properties and select the Actions tab. Set the trigger to Mouse Up, choose Run a JavaScript, and add checkAllA1();.
Why does the script use index 0?
The example uses index 0 for the first checkbox widget associated with each field name. If a field has multiple widgets, check the form's structure and adjust the script as needed.
Will the automatic checkbox work in every PDF viewer?
Not necessarily. The viewer must support the Acrobat JavaScript and form actions used by the PDF. Test the saved form in the viewer your recipients will use.




