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

How to auto check one checkbox after three or more checkbox has been checked by the user.

Community Beginner ,
Mar 07, 2024 Mar 07, 2024

Hello,

 

I need to have a checkbox automatically checked once three other check boxes has been checked by the user. I have attached a photo for a more visual look of what I have.

 

As it states "3 Required for 1 class B" Once the user checks 3 of the bottom boxes I need the check box off to the right to be checked. I understand Javascript will be involved. I understand how to make a 1:1 work but not so much a 3:1 considering the only way to trigger the script is a "Mouse up" trigger. So how would that work with three checkboxes? Any help would be grateful thanks. 

 

 

Screenshot (5).png

TOPICS
Edit and convert PDFs , JavaScript , PDF , PDF forms
1.1K
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 ,
Mar 07, 2024 Mar 07, 2024

You can use the calculation script of a (hidden) text field for that. What are the names of the fields involved?

Also, should the check-box on the side be ticked if more than 3 boxes are ticked in the table?

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 Beginner ,
Mar 07, 2024 Mar 07, 2024

Hmm how do I do the calculation of a (hidden) text field. Mind you these need to be checkboxes I don't see a calculation optioin for checkboxes. I have provided a new picture that displays the name of each box. Yes, 3 is the requirment if there's more I guess the box would just stay checked. Thanks for your input

 

 

 

Screenshot (6).png

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 ,
Mar 07, 2024 Mar 07, 2024
LATEST

You can create text field and make it hidden and place script in its custom calculation, or you can use any text field you already have in your file and place script in its custom calculation script.

var fields = ["NAIL CHANGE RIGHT", "PIGMENTED RIGHT", "SKIN TEXTURE RIGHT", "DIGITAL HAIR GROWTH RIGHT", "SKIN COLOR RIGHT"];
var checked = 0;
for ( var i=0; i<fields.length; i++){
 if(this.getField(fields[i]).valueAsString !== "Off")
  checked++;}
this.getField("Q8").checkThisBox(0, (checked >= 3) ? true : 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