Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Checkbox checked then other checkboxes become both checked and disabled

New Here ,
Nov 24, 2017 Nov 24, 2017

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

TOPICS
PDF forms
11.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Explorer ,
Feb 08, 2018 Feb 08, 2018

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.

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Dec 25, 2017 Dec 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 27, 2017 Dec 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 PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 08, 2018 Jan 08, 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 08, 2018 Jan 08, 2018

The ReadOnlyness is not being set properly.  There are a couple of things you can do to find out why it's not working.

First, check the box on Checkbox1 and then put the form in "prepare form" mode and open the properties dialog for checkbox2. Check the Export value on the Options tab. Is it set to Yes?  If not, change the code to match this export value.

If this is not the issue, then look in the Console Window to see if there are any reported errors.

The Acrobat JavaScript Console Window - YouTube

Also try manually setting the ReadOnly property to see how the check boxes behave.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 07, 2018 Feb 07, 2018

Hi Thom,

Export value

The export value is set to “yes” for all three checkboxes. Still checkbox2 and checkbox3 become just checked when checkbox1 is checked, but they don't become disabled (by disabled I mean not checkable, not clickable).

Set Read Only manually

I’ve also, In addition to the script, manually set Read Only in the properties dialog (on the General tab) for checkbox2 and checkbox3,

What happens then when I go to the preview mode:

-Before I check checkbox1, the other two checkboxes (checkbox2 and checkbox3) are disabled.

-But then when I check checkbox1, the other two becomes checked, but the problem remains that you can still uncheck/check checkbox2 and checkbox3.

After this I go back to the edit mode to the properties dialog (on the General tab) for checkbox2 and checkbox3. Now the Read Only property has deactivated itself. I’ve tested to lock the Read Only after I’ve marked it in the same properties dialog, but I get the same result in preview mode. Afterwards I return to the edit mode to the properties dialog where the “Locked” function is still set, but strange enough the Read Only property has deactivated itself anyway.

Console window

I’ve tested the script in the console window and got this message:

TypeError: event.target is undefined
1:Console:Exec
undefined

As I’m a java script beginner I’ve no clue what this means.

What should I do?

Thanks a lot for helping me out.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 07, 2018 Feb 07, 2018

So your saying that checking "checkbox1" turns the Read Only off for 2 & 3. This make sense if the export value is set to "yes" as you say, since, the code uses "Yes". See the difference? Case matters. The match has to be verbatim. Either change the export value to "Yes' or change the code to use "yes".

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 07, 2018 Feb 07, 2018

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.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 08, 2018 Feb 08, 2018

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 22, 2025 Jul 22, 2025
LATEST

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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines