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

If/then statement for dropdown and check box

Community Beginner ,
Jan 05, 2024 Jan 05, 2024

Copy link to clipboard

Copied

How do I write a javascript to select or not select a checkbox based on the answer given in a dropdown? So for example

 

If "yes" is selected in the dropdown, the N/A checkbox is not selected.

If  "no" is selected in the dropdown, the N/A checkbox is selected.

TOPICS
How to , JavaScript , PDF , PDF forms

Views

166

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 , Jan 05, 2024 Jan 05, 2024

As validation script of dropdown field, use this:

if(event.value == "yes")
 this.getField("N/A").checkThisBox(0,false);
else if(event.value == "no")
 this.getField("N/A").checkThisBox(0,true);

Votes

Translate

Translate
Community Expert ,
Jan 05, 2024 Jan 05, 2024

Copy link to clipboard

Copied

As validation script of dropdown field, use this:

if(event.value == "yes")
 this.getField("N/A").checkThisBox(0,false);
else if(event.value == "no")
 this.getField("N/A").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 ,
Jan 05, 2024 Jan 05, 2024

Copy link to clipboard

Copied

Seems simple enough, but I can't get it. Are there any other settings I should check?

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 ,
Jan 05, 2024 Jan 05, 2024

Copy link to clipboard

Copied

Check if checkbox name is "N/A" and if dropdown choices are "yes" and "no" or "Yes" and "No", because it's case-sensitive.

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 ,
Jan 05, 2024 Jan 05, 2024

Copy link to clipboard

Copied

LATEST

That's it! I didn't realize it was case sensitive. Thanks so much for your help and quick reply.

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