So I found the need to use the RadioButton component the other day in one of the projects I was building.
I made it a part of the RadioButtonGroup and thus only one out of them could be selected at a time.
I wanted to reset all the radio buttons in a group once the group lost focus. ie. Wanted the icon to be blank.
I tried using btnInstance.selected=false. But that didn’t work.
After hunting for a solution on the internet for a while I came across this little trick that works fabulously well.
1) Just create another radio button and assign it to the same group.
2) When you want to set the selection of any of your groups radio buttons to false, just set the selected property of the new radio button added in step 1 to true!
3) Since this is a part of the RadioButtonGroup which means only 1 radiobutton can be active at all times, it deactivates all the other ones.
Short & Sweet 🙂