if ($w('#switch1').checked) {
$w('#radioGroup1') === 10
} else {
$w('#radioGroup1') === 0
}
1 Like
Hello,
If you want to assign a value to a RadioButtonGroup element, you can use selectedIndex that s ets or gets the index of the selected option.
https://www.wix.com/corvid/reference/$w.RadioButtonGroup.html#selectedIndex
So your code should look something like this (you may of course adjust it depending on the desired functionality):
export function switch1_click(event) {
if ($w('#switch1').checked) {
$w("#radioGroup1").selectedIndex = 0;
} else { $w("#radioGroup1").selectedIndex = undefined; }
}
Note: To set one of the options to be selected, set theselectedIndexproperty to an index between0andoptions.length-1.
To reset the radio button group to have no option selected, set theselectedIndexproperty toundefined.
Good luck!
Thank you