I’m a Python developer helping a client get a website set up with Anvil.
My client wants to check if signed-up users have a particular field filled out, and if not, to redirect them to a page to have that field filled out.
In trying to make this work, I’m finding that I can’t seem to get open_form()
to work after login_with_form()
has been called. It’s as if the __init__
function immediately quits.
How do I make it work?
If I understand correctly, perhaps try triggering the open form command in a “form show” event. You can check the docs on events if you are not familiar with them.
Please share a clone link to demonstrate the issue if I am misunderstanding something.
1 Like
This was solved as suggested through PM.
1 Like
For future users:
you need to go to the ‘Design’ tab and on the right side set the function you want to run when the ‘show’ event happens; it isn’t the case that certain function names just get called automatically on certain events.
1 Like
@alcampopiano Why not have those lists of events in the ‘Code’ view as well?
I’m not sure exactly how that would look, but my guess is that, since you can have all different types of events on all different types of components, it is easier to show the event type, the callback function, and the associated component, when the component in question is selected (in the deign view). Of course, components can also share the same callback function as well, and so I’m not quite certain how that might look if those details were exposed somehow in the code view.
Those are my guesses as a regular Anvil user (not Anvil staff).
2 Likes