Python, Flask, unable to display validation error messages

Hello All,

I’m working through a Youtube video to put together a registration form using python and flask and I’m stuck displaying validation error messages below each user entry fields. Everything else seems to be working. I’m not getting any error message to indicate issues with my application but I just can’t seem to get the error messages to appear below the user entry field and could use some help.


                        <!-- First name -->
                        <div class="col-sm-12">                             
                            {{ form.firstName.label(class="form-control-label")}}
                            {% if form.firstName.errors %}
                                {{ form.firstName(class="form-control is-invalid") }}
                                    <div class="invalid-feedback">
                                        {% for error in form.firstName.errors %}
                                            <span>{{ error }}</span>
                                        {% endfor  %}
                            {% else %}
                                {{ form.firstName(class="form-control") }}
                            {% endif %}
                        </div> <!-- END of first name -->

                        <!-- registration submit button -->
                        <hr class="my-3">                        
                        {{ form.submit(class="w-100 btn btn-primary btn-lg") }}

python/flask script

@auth_bp.route("/registration", methods=["POST", "GET"])
def registration():
     # registrationForm class created below
     regForm = registrationForm()
     if regForm.validate_on_submit():
          flash(f'Account created for {}!', 'success')
          return redirect(url_for('home_bp.home'))
     return render_template("registration.html", title="Register", form=regForm )

class registrationForm(FlaskForm):
     firstName = StringField("First Name", validators=[DataRequired(), Length(min=2, max=50)])
submit = SubmitField("Sign UP")