Creating a Single Check All/Check None check box
I have a PDF with a large number of pages, each page of which has its own set of 10–15 named check boxes. These need to be checkable in any combination and independent of one another. However, I'd also like to create a single Check All box on each page that, on the first click that marks the Check All box, places a check in all boxes on the page and, on second click that clears the Check All box, clears all boxes on the page. How do I do this?
At the moment, I have it so each page has separate Check All and Check None boxes. This is more or less functionally fine, but looks clumsy across so many pages and seems to confuse some users. Currently, I'm using Actions --> Mouse Up --> Run a JavaScript with the following scripts.
For Check All box:
if (event.target.value == "Yes")
this.getField ("CheckNone").value = "No"
this.getField ("Item1").value = "Yes"
this.getField ("Item2").value = "Yes"
this.getField ("Item3").value = "Yes"
this.getField ("Item4").value = "Yes"
this.getField ("Item5").value = "Yes"
This checks all boxes on the page and forces the Check None to be cleared. If this box is checked a second time, the tick disappears but all items on the page are checked again (assuming some have been manually cleared).
For Check None box:
if (event.target.value == "Yes")
this.getField ("CheckAll").value = "No"
this.getField ("Item1").value = "No"
this.getField ("Item2").value = "No"
this.getField ("Item3").value = "No"
this.getField ("Item4").value = "No"
this.getField ("Item5").value = "No"
This unchecks all boxes on the page, including Check All, and leaves a cross in Check None. If this box is checked a second time, the cross disappears but all items on the page are unchecked again (assuming some have been manually checked).
In other words, I'd like to merge the functionality of these two scripts into one on alternating clicks. I hope this makes sense. Thank you!
