Skip to main content
dennisg19059968
Participating Frequently
November 24, 2017
Answered

Checkbox checked then other checkboxes become both checked and disabled

  • November 24, 2017
  • 2 replies
  • 12095 views

Hi,

I've read an earlier explanation of a similiar question, but in my beginner-eyes the discussion became to advance for me to understand.

Therefore, I try to ask my question here instead.

In my pdf form I have three checkboxes named: checkbox1, checkbox2 and checkbox3.

I wish the following to happen:

If checkbox1 is checked, then checkbox2 and checkbox3 also becomes checked,

but at the same time checkbox 2 and checkbox3 also become disabled (by disabled

I mean not checkable, not clickable).

Thank you for helping me out.

/Dennis

Correct answer dennisg96201989

I didn't mean for you to run the script "as is" in the console. Just to test getting the checkbox1 value setting the read only. The "event" object is only valid in the scripting context of object it's run on. So a field event property doesn't make sense in the console. You have to replace it with the intended value, which is this case is the field object for checkbox1.


Thanks alot Thom, now its working perfectly fine. Due to your latest answer you finally helped me realize that the actual problem was that I really thought I had set the export value to “Yes” but in reality the export value was set to “Ja” which is Swedish for “Yes”.

The reason for this is that my Adobe Acrobat Pro DC program has the language setting Swedish (I’m Swedish). When I create I new checkbox in a empty form, the export value is automatically set to “Ja” (Swedish for “Yes”) by default. When I changed the export value from “Ja” to “Yes”, which I should have realized before from your earlier answers, the Script works perfectly fine.

As I’m a Javascript-rookie I didn’t reflect on this until your latest answer.

Again, thanks a lot Thom for explaining this in a very clear and beginner-friendly way, and I’m glad that it finally works.

2 replies

Participant
July 22, 2025

You can do this with a simple script on checkbox1 using JavaScript for PDF forms (like in Adobe Acrobat):

 

javascript
CopyEdit
if (event.target.value == "Yes") { this.getField("checkbox2").checkThisBox(0, true); this.getField("checkbox2").readonly = true; this.getField("checkbox3").checkThisBox(0, true); this.getField("checkbox3").readonly = true; }
 

Just place this in the Alano DT Game Download "Mouse Up" action of checkbox1. Hope this simplifies it!

Legend
December 25, 2017

Hi Dennis,

Sorry for the delay in response.

I assume when you were creating this form, you might have copied the fields rather pasting a new field on the form. So when you are acting on a field rest of the fields are copying this action automatically.

Either you can delete all the fields which are copying action from previous fields or rename all the fields with a unique name.

If you already have found a workaround or a solution to this issue, please update this discussion with your findings that will help others.

-Tariq Dar

Thom Parker
Community Expert
Community Expert
December 27, 2017

This script also unchecks the check boxes when the first is unchecked

Put this script on the MouseUp script for "checkbox1".

this.getField("checkbox2").value = event.target.value;

this.getField("checkbox2").readonly = (event.target.value == "Yes");

this.getField("checkbox3").value = event.target.value;

this.getField("checkbox3").readonly = (event.target.value == "Yes");

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
dennisg19059968
Participating Frequently
January 8, 2018

Hi Thom,

Thanks for the script you've been given.

I pasted the script on the MouseUp script for "checkbox1" and the following is happening:

  • When checkbox1 is checked/unchecked, the checkbox2 and checkbox3 becomes checked/unchecked

This is great, but at the same time the the following is not working:

  • When checkbox1 is checked, checkbox2 and checkbox3 are still clickable (I can still check/uncheck them), I wish them to get checked and disabled at the same time, when checkbox1 is checked.

What am I doing wrong?

/Dennis