When I fill the form with data correctly, it creates the account and redirects to the login page - just as it should work. But when I will do something against the validators eg. try to create a username with only one character - then an account won't be created (which is good), but also any error message won't appear. After many hours of experiments and changing the code, I still don't know what's causing that problem, especially when I used to create things like that using the same method and everything worked perfectly. If you need more information/code please tell me and I'll edit the post.
Registration Form:
class RegistrationForm(FlaskForm):
username = StringField('Name',
validators=[DataRequired(), Length(min=2, max=20)],
render_kw={"placeholder": "Username"})
email = StringField('Email',
validators=[DataRequired(), Email()],
render_kw={"placeholder": "Email"})
password = PasswordField('Password',
validators=[DataRequired()],
render_kw={"placeholder": "Password"})
confirm_password = PasswordField('Confirm Password',
validators=[DataRequired(), EqualTo('password')],
render_kw={"placeholder": "Confirm Password"}) # equal to password field
submit = SubmitField('Sign Up')
HTML:
<section class="banner-b">
<div class="registration-box">
<h1>Register</h1>
<form method="POST">
{{ form.hidden_tag() }}
<div class="textbox">
{% if form.username.errors %}
<div class="invalid-feedback">
{% for error in form.username.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
<i class="fa fa-user" aria-hidden="true"></i>
{{ form.username(class="text") }}
{% endif %}
</div>
[... other forms for email, password etc...]
</div>
I am not familiar with Flask as I am Django fan, may be try this,