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

Can't get code to work to multiple check boxes. Forms Javascript.

Explorer ,
Oct 04, 2023 Oct 04, 2023

Copy link to clipboard

Copied

I want to be able to  check checkbox 1, then checkbox 2. If both of those boxes are checked I want checkbox 4 to be automatically checked. This is what I have tried but it does not work. Any help would be great. Thanks. 

var checkbox1 = this.getField("Checkbox1").value;
var checkbox2 = this.getField("Checkbox2").value;

if (checkbox1 === "Yes" && checkbox2 === "Yes") {
this.getField("Checkbox4").value = "Yes";
} else {
this.getField("Checkbox4").value = "Off";
}

TOPICS
PDF forms

Views

519

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 , Oct 04, 2023 Oct 04, 2023

Hi,

There must be an error, maybe in the export value of a checkbox ("Yes" spelled wrong???) because the script is correct.

And here you can use either the strict equality symbol (Checkbox1) or the simple equality symbol (Checkbox2).

@+

Votes

Translate

Translate
Community Expert ,
Oct 04, 2023 Oct 04, 2023

Copy link to clipboard

Copied

Where did you put this code?

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
Explorer ,
Oct 04, 2023 Oct 04, 2023

Copy link to clipboard

Copied

Javascipt, mouse up on Checkbox 1 and 2

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 ,
Oct 04, 2023 Oct 04, 2023

Copy link to clipboard

Copied

Move it to be the Calculation script of a (hidden) text field.

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 ,
Oct 04, 2023 Oct 04, 2023

Copy link to clipboard

Copied

Where does you use the script? 

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
Explorer ,
Oct 04, 2023 Oct 04, 2023

Copy link to clipboard

Copied

In Javascript area from checkbox 1 and 2 

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 ,
Oct 04, 2023 Oct 04, 2023

Copy link to clipboard

Copied

Hi,

There must be an error, maybe in the export value of a checkbox ("Yes" spelled wrong???) because the script is correct.

And here you can use either the strict equality symbol (Checkbox1) or the simple equality symbol (Checkbox2).

@+

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
Explorer ,
Oct 05, 2023 Oct 05, 2023

Copy link to clipboard

Copied

Thank you, will check again. Had some odd things with Acrobat forms lately.

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
Explorer ,
Oct 05, 2023 Oct 05, 2023

Copy link to clipboard

Copied

LATEST

Thanks again, I know where I made my "rookie" mistake.

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