Skip to main content
Participating Frequently
January 5, 2024
Answered

If/then statement for dropdown and check box

  • January 5, 2024
  • 1 reply
  • 986 views

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.

This topic has been closed for replies.
Correct answer Nesa Nurani

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

1 reply

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
January 5, 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);
Participating Frequently
January 5, 2024

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

Nesa Nurani
Community Expert
Community Expert
January 5, 2024

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