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

Help setting check boxes in Acrobat Pro DC

Community Beginner ,
Apr 22, 2019 Apr 22, 2019

Copy link to clipboard

Copied

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

Views

968

Translate

Translate

Report

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);

Votes

Translate

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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);

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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 )

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Is the other field named CB2?

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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!

Votes

Translate

Translate

Report

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