Topic: Login-Register Form (Pill) with Flask - error on register tab does not redirect back to register tab, but instead to login tab
Hi – I’m using the tabbed Login/Registration form with a Python-Flask project and am using WTFORMS for form validation. When I encounter an error where one of my form fields does not meet certain criteria, I redirect to the login form page. This works fine for the login tab, but when I encounter an error on the register tab, it redirects to the login page where the login tab is highlighted.
Is there anyway to redirect to the login page and highlight the second tab – the registration? When I do click on the register tab, it does show my errors, but that makes for a bad user experience to have to click back to the register tab.
Have you tried
show option to toggle
register tab right after the site is loaded?
You can also use it in classes, like in this snippet: https://mdbootstrap.com/snippets/standard/m-duszak/3080220
Thanks for the info. making the page default is not a problem from js or within the html, but I'm trying to do it on submission error out and redirecting to the same page to display the error. My python is:
return render_template('login.html',register_form=register_form, login_form=login_form)
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
- User: Pro
- Premium support: Yes
- Technology: MDB Standard
- MDB Version: MDB5 3.5.1
- Device: mabbook
- Browser: chrome
- OS: macOS Big Sur
- Provided sample code: No
- Provided link: No