Some radio button value capture issues

What I’m trying to do:
I am trying to capture the value of a radio button, that is in a group of 3,when selected.
The buttons are not in a column panel.
I will then capture the value in a data table

What I’ve tried and what’s not working:

def radio_buttons_selected(self):
    if self.radio_button_1 or self.radio_button_5 or self.radio_button_9.selected:
      if self.radio_button.selected:
        print(self.radio_button.value)

Have you read these docs?

Here you are checking if radio_button_1 exists, if it does you check if radio_button_5 exists, if it does you check if radio_button_9 is selected.

I think you should do this:

if self.radio_button_1.selected or self.radio_button_5.selected or self.radio_button_9.selected
1 Like

I did but was still battling to get a hold of it

Hi Stefano
Thanks I see what I was doing now.
I am still not sure how to return or print the value of the selected button

If they all have the same group_name attribute (or if all your radio buttons on the form are in the same default group, with group_name left undefined), you can do:

print(radio_button_1.get_group_value())

It doesn’t matter which of the radio buttons you call this method on.

1 Like

Thanks
hugetim.That solved it.

1 Like