Skip to main content
Participant
March 7, 2024
Question

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

  • March 7, 2024
  • 2 replies
  • 1024 views

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. 

 

 

This topic has been closed for replies.

2 replies

Nesa Nurani
Community Expert
Community Expert
March 8, 2024

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);
try67
Community Expert
Community Expert
March 7, 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?

Participant
March 7, 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