CheckboxGroups and user result

Hello everyone,
I have three multi-checked box groups i want user to check their options from any group or mix their selection as they want.
then I want after click on next button :

  • if most selected options from CheckboxGroup one there is a change multi state slide direct visitor to another.
  • if most selected options from CheckboxGroup two there is a change multi state slide direct visitor to another.
  • if most selected options from CheckboxGroup three there is a change multi state slide direct visitor to another.
  • if the selected options from group one equal group two there is a change multi state slide direct visitor to another.
  • if the selected options from group two equal group three there is a change multi state slide direct visitor to another.
  • if the selected options from all groups equal other two groups there is a change multi state slide direct visitor to another.
  • if there is no selection error message display.

Please provide a pic of your setup, your description is not clear.

  • if the selected options from all groups equal other two groups there is a change multi state slide direct visitor to another.

…to another what?

Always try to describe your issue as most detailed as possible, to get a best ANSWER.

  • if the selected options from all groups equal other two groups there is a change multi state slide direct visitor to another.

i meant :

if the selected options from all groups equal there is a change multi state slide direct visitor to another.

to another state box

Check this out and try to complete this code, implementing a corresponding action to open a state for the current OUTPUT-RESULT of this code.

!!!Note!!!
This code is not able to find CBGs with equal amount of selected options.
You will have to expand it’s functionality.

Check out the CONSOLE-LOGS inside of your Wix-Editor in the Previe-Mode.

$w.onReady(()=>{
    $w('#btn1').onClick(()=>{check();});
});

function check() {
    let maxLength = 0, maxElement;
    //----------------------------
    cbgValue[0] = $w('#cbg1').value;
    cbgValue[1] = $w('#cbg2').value;
    cbgValue[2] = $w('#cbg3').value;
    
    console.log("CBG = Check-Box-Group!!!");
    for (let i = 0; i < cbgValue.length; i++) {
        const element = cbgValue[i];
        console.log("CBG-"+(i+1)+": ", cbgValue[i]);
        
        if (element.length > maxLength) {
            maxLength = element.length;
            maxElement = i;         
        }
        if (i===cbgValue.length-1) {
            console.log("Found cbg-"+(maxElement+1)  + ", with "+ maxLength+"-items inside!");
            console.log("CBG-"+(maxElement+1)+" has the most selected options!!!");
        }       
    }   
}
  1. btn1 = button
  2. cbg = CheckBoxGroup