Select/deselect a checkbox as related checkboxes are selected/deselected
I'm creating a PDF form using Acrobat DC. The form has five checkboxes for tests available from Laboratory A and 18 checkboxes for tests available from Laboratory B. I'm looking for a way that I can have a checkbox for Laboratory A (LabA_CB) automatically select when one or more of the available tests at Laboratory A is selected, and a second checkbox for Laboratory B (LabB_CB) automatically select when one or more of the available tests at Laboratory B is selected.
However, I also need the Laboratory A and B checkboxes to deselect if all of the associated tests for that lab are deselected. The code I've tried so far either does not deselect the Laboratory A and B checkboxes even if all associated test checkboxes are deselected, or it deselects the Laboratory A and B checkboxes each time one of the associated tests is deselected even if other associated tests remain selected. I think this is because the only code I've been able to find is for the mouse up event for each of the individual test checkboxes.
I am a complete JavaScript novice, but I hope there is a way to make the Laboratory A and B checkboxes "check" to see if any of the tests associated with that lab have been selected/deselected. Each of my test checkboxes is named with the associated lab and actual test name (e.g., LabA_Protein_CB, LabA_Fiber_CB, LabB_Iron_CB, LabB_Lead_CB) and the export value is also set to the test name. I need it to be set up this way for exporting data into Excel.
Any advice would be much appreciated! Searching for anything related to checkboxes seems to only return answers regarding select/deselect all or calculations.
