Help! Clicking 'next' button on slide doesn't submit pre-selected radio button values. Thanks!!

I’m just storing the values in radio button groups e.g. $w(“#radioGroup1”) each have their own labels and values, When they select a radio button it is stored in the section1 array. - the rest of the code turns the output into an averaged score.


const section1 = [$w(“#radioGroup1”), $w(“#radioGroup2”), $w(“#radioGroup3”), $w(“#radioGroup4”)];
let s1totalCount = 0;
section1.forEach(e => {
e.onChange((event) => {
let selected = section1.filter(o => o.valid);
s1totalCount = selected.reduce((a, c) => a + Number(c.value), 0);
avg1 = Math.round(s1totalCount / section1.length);
calculateFinalAvg();
$w(“#text57”).text = avg1.toString();
})
})