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

Help setting check boxes in Acrobat Pro DC

Community Beginner ,
Apr 22, 2019 Apr 22, 2019

Hello, I am working on a form where once one checkbox is clicked, I need it to automatically check another box. My issue is I need the checkbox that would automatically be checked to have the capability to be unchecked without unchecking the first checkbox. Is this do-able?

TOPICS
Acrobat SDK and JavaScript , Windows
1.2K
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

correct answers 1 Correct answer

Community Expert , Apr 22, 2019 Apr 22, 2019

Well, step one is to give the second field a unique name. Let's say the first one is called CB1 and the second CB2.

Add this code as the Mouse Up event of CB1:

if (event.target.value!="Off") this.getField("CB2").checkThisBox(0, true);

Translate
Community Expert ,
Apr 22, 2019 Apr 22, 2019

Should the second check-box be un-checked when the first one is?

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 Beginner ,
Apr 22, 2019 Apr 22, 2019

Yes. It should only be checked when the first one is. The first checkbox is the general product, and there are 6 checkboxes underneath as options. We want one option to be automatically checked once the first box to checked, but have the capability to choose another checkbox if the customer wants a different option. Currently, if I try to uncheck the second checkbox, it unchecks the first one, which I don't want to do.

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 ,
Apr 22, 2019 Apr 22, 2019

Well, step one is to give the second field a unique name. Let's say the first one is called CB1 and the second CB2.

Add this code as the Mouse Up event of CB1:

if (event.target.value!="Off") this.getField("CB2").checkThisBox(0, true);

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 Beginner ,
Apr 22, 2019 Apr 22, 2019

Hi try67,

Thank you for your response! I renamed both of the check boxes and for the CB1 I did the following: Clicked properties, actions, select trigger: mouse up, select action: run a JavaScript, and then I copied and pasted the following into the "Add.." field:

if (event.target.value!="Off") this.getField("CB2").checkThisBox(0, true);

Unfortunately, the second box doesn't automatically check now. Did I do something wrong?

(Thank you for your help as I am very new to this and trying to understand )

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 ,
Apr 22, 2019 Apr 22, 2019

Is the other field named CB2?

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 Beginner ,
Apr 22, 2019 Apr 22, 2019
LATEST

Oh my gosh, there was a typo! Now that is it "CB2" it works like a charm! Thank you so, so much for your help! It is greatly appreciated!

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