I have an app with a logout link in the menu bar. When it’s clicked, I’d like the entire content of the app to disappear and then call anvil.users.login_with_form()
I can clear the content panel, but the menu and navbars are still visible behind the login form. Is there a way I can clear those and make it look exactly the same as when the app is first visited?
Right, I further assume you are then dynamically updating those with menu options and the like at runtime? Reloading the page should show what was present at design time unless you add things at runtime.
I was thinking have a Login form that shows the popup.
Then in your main form init, open that form if the user is not logged in.
Then in your logout method, open the login form.
Something like that.
Your initial blank page relies on the fact the form underneath has not been shown yet.
If you take that approach, make sure to do the login code on the login form in the “show” event, not under init else the Main form will still be visible. Example :
Note: I have added navigation items as a component on each form and have a logout link within that component. On the start page I have the login form on start up if the user is not logged in.