Skip to main content
Participating Frequently
January 10, 2024
Question

Checkbox to Disable other checkboxes

  • January 10, 2024
  • 1 reply
  • 1577 views

Hi there, I have a case assement checklist I am building for evaluating my teams cases.  I have a question and the option of Yes, No, and NA.  There are 23 questions and each Checkbox is lables Yes1, No1, NA1 ( repeats with a higher number to 23).  For each question, if someone selects a check box, I want the other two check boxes to disable.  Would this be possible?   

 

So for question 1,  if someone selects yes ( checkbox name yes1) I want checkbox No (checkbox name No1 and NA (checkbox name NA1) to disable.  

 

Thank you!! 

This topic has been closed for replies.

1 reply

try67
Community Expert
January 10, 2024

To do that you should rename the fields in each "group" so that they have the same name (such as "Question1") and unique export values (such as "Yes", "No", "N/A"). Then they would act as you've described automatically.

Rach3ll3gAuthor
Participating Frequently
January 10, 2024

So, my export value is set to 1 for each box, because I have it automatically tallying the number of yes and no responses to a total fields.  

 

Nesa Nurani
Community Expert
January 11, 2024

Thank you, Yes javascript is what I am looking into.  I will review the calculation suggestions I found and work through them and will post again if I have any questions.  I appreciate the suggestions! 

 


Best approach to make checkboxes mutually exclusive is to give them same name and different export value as suggested by try67, but if you don't want to change them now you can use this script in any text field as custom calculation script(field can be hidden):

for(var i=1; i<=23; i++){
 var yes = this.getField("Yes"+i);
 var no = this.getField("No"+i);
 var na = this.getField("NA"+i);
 
if(yes.value !== "Off"){
 no.readonly = true;
 na.readonly = true;}
else if(no.value !== "Off"){
 yes.readonly = true;
 na.readonly = true;}
else if(na.value !== "Off"){
 yes.readonly = true;
 no.readonly = true;}
else{
 yes.readonly = false
 no.readonly = false;
 na.readonly = false;}}