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

Checkbox to Disable other checkboxes

Community Beginner ,
Jan 10, 2024 Jan 10, 2024

Copy link to clipboard

Copied

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!! 

TOPICS
JavaScript , PDF forms

Views

460

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

Copy link to clipboard

Copied

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.

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

Copy link to clipboard

Copied

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.  

 

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

Copy link to clipboard

Copied

I recommend you change it. A simple script can be used to replace your calculation so that it still works with the new names and export values.

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

Copy link to clipboard

Copied

Thank you! I have looked at some of the calculation scripts to try and calculate, but was struggling with them.  

I am new to building forms and looking at Java courses.  

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

Copy link to clipboard

Copied

It's Javascript, though, not Java...

And if you need help with that code post here again.

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

Copy link to clipboard

Copied

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! 

 

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

Copy link to clipboard

Copied

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

 

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

Copy link to clipboard

Copied

Thank you - If I can't figure out the calculation script to automaticaly tally the total number of checkboxes, Iw ill give this a try!  

 

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

Copy link to clipboard

Copied

LATEST

Hi Nesa,  This worked perfectly!!  I have one more question.  I have 5 questions that are in a section, not related to the 23 original checkboxes.  This is just Yes and NA options.  I tried giving each question's checkbox the same name, but a different export value.  However, it is not making the option mutually exclusive.  Would the script you provided cause that?  

 

Thank you, 

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