Title: PDF Editable File (JavaScript)
Tags: pdf;checkbox
Question: I've got 5 checkboxes on my pdf file ..
Check box 1 .. "ALL Options"
Check box 2 .. "1st Option"
Check box 3 .. "2nd Option"
When I click check box one, changed to CHECK, I want check box 2 and 3 also to be checked, when I click check box again to UNCHECK, I want box 2 and 3 also unchecked
Comment: And what have you tried to implement that? And what is the problem you could not overcome?


Here is another answer: Assume field names are "CB1", "CB2" and "CB3" put the following code as a JavaScript in the MouseUp action of CB1.
var cb2 = this.getField("CB2")
var cb3 = this.getField("CB3")
if (event.target.value == "Off") {
cb2.value = "Off";
cb3.value = "Off";
else {
cb2.value = cb2.exportValues;
cb3.value = cb3.exportValues;
This works because the unchecked value of a checkbox in PDF is always "Off". While the checked value of the checkbox can be any string, you can set the value of the field to the checked value using the exportValues property without knowing what the checked value actually is.

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 1, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2017:00:04/12/17', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<pdf><checkbox>', 'Title': 'PDF Editable File (JavaScript)', 'ViewCount': 33, 'id': 43371857, 'user_AboutMe': None, 'user_AccountId': 10672260.0, 'user_DisplayName': 'Bruce Els', 'user_Reputation': 1.0, 'user_Views': 0.0, 'user_id': 7856991.0}}