Render and Submit a Form
Show fields in a template and handle submit.
From Class to Page
A form class is useless until a user can see it. Now you will render those fields into HTML and accept the submission back. 🖋️
Pass the Form to the Template
Create the form in your view and hand it to render_template. The template gets a live object full of fields it can draw.
form = LoginForm()
return render_template('login.html', form=form)All lessons in this course
- Define a FlaskForm Class
- Render and Submit a Form
- validate_on_submit and CSRF Tokens
- Custom Validators and Field Errors