Went with this option. Easier to adjust the max individually. Code Below.
let selectedIndices ;
$w . onReady ( function () {
$w ( “#checkboxGroup1” ). onChange (( event ) => {
if ( $w ( “#checkboxGroup1” ). value . length < 4 ){
//add a notification for the user
} else if ( $w ( “#checkboxGroup1” ). value . length === 4 ){
selectedIndices = $w ( “#checkboxGroup1” ). selectedIndices ;
} else if ( $w ( “#checkboxGroup1” ). value . length > 4 ){
$w ( “#checkboxGroup1” ). selectedIndices = selectedIndices ;
//add a notification for the user
}
})
});