We now have a web application that is largely functional, but still fails to provide the user with helpful feedback, especially when it comes to submitting web forms. Let's look at how to make our application more intuitive by providing feedback when the user succeeds or fails to complete various actions.
To make our life easier, we'll use another Flask add-on, WTForms, which lets us validate inputs by using prespecified patterns or by creating our own. We'll use WTForms to implement all our web forms, namely:
The registration form
The sign-in form
The create table form
You might have noticed that creating the registration form for new users to sign up for our web app was a bit cumbersome. We had to create the HTML form in our template file and then fetch all the input data when the form was submitted in our Python backend code. In order to do this, we had to use the same strings, such as email
and password
, in our HTML code (for the name
attribute...