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

Toggle Checkboxes with Conditional Criteria

New Here ,
Nov 01, 2022 Nov 01, 2022

Hello,

I have previously been successful with setting up a toggle between 2 checkboxes. I am attempting to do something similar, only with one side of the toggle being a list of checkboxes.

 

Checkboxes 1-12 list items wherein multiple selections can be made. Checkbox 13 indicates that no items 1-12 are applicable. I am hoping to set it up so that if one or more selections are ticked 1-12, then checkbox 13 is unticked. Also, if multiped items are ticked 1-12 and the end user  unticks only one item while the others remain ticked, that checkbox 13 will only toggle on if all items 1-12 are unticked. 

 

Is there a conditional formula or javascript that will say, for example,  to check box 13 if checkbox 1 is unticked and checkboxes 2-12 are unticked?

 

I hope I explained that well enough. Thank you for your help!

TOPICS
Create PDFs
429
Translate
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 ,
Nov 02, 2022 Nov 02, 2022

Do you want the user to be able to tick (or untick) box 13 manually, or should it only be determined by the state of the other fields?

Translate
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
New Here ,
Nov 03, 2022 Nov 03, 2022
LATEST

I would like it to be determined by the state of the other fields. 

 

Thank you

 

Translate
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 ,
Nov 02, 2022 Nov 02, 2022

If I understand you right you can use this in a text field (can be hidden) as custom calculation script, if any or multiple checkboxes 1-12 are ticked it will set checkbox 13 to read-only and if checkbox 13 is ticked it will set checkboxes 1-12 to read-only:

var n = 0;
for( var i=1; i<=12; i++){
if(this.getField("Checkbox "+i).valueAsString != "Off")n++;
if (n != 0)
this.getField("Checkbox 13").readonly = true;
else
this.getField("Checkbox 13").readonly = false;
if(this.getField("Checkbox 13").valueAsString != "Off")
this.getField("Checkbox "+i).readonly = true;
else
this.getField("Checkbox "+i).readonly = false;}

Translate
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