Have page "reload" after choosing Radio Buttons?

Hello,

My app is fairly simple. There’s a list, and on startup two random samples are taken from this list. The first appears as both the value and text of the first Radio Button; the same for the second sample and second Radio Button.

This value is then recorded in a database, with the chosen button as the “winner” and the second as the “loser”. My problem is that as soon as one button is clicked, after the values are recorded in the table, I want the whole thing to refresh and show the user two new random values.

Any help? I don’t want the user to have to press a button to refresh; I’d rather it be seamless and happen after they click on the button (so I’d put it underneath the def radio_button_1_clicked(self, **event_args) arguments)

Thank you!

You can put any code you want in that function. You must have code that initially generates the random values and sets up the form. Call that code from inside the radio button clicked function, too.

If you’re having troubles with specific code trying to do that, sharing a clone link helps a lot. This page in the docs talks about how to get a clone link: Anvil Docs | Cloning Apps

2 Likes