The error message of the form I am creating is not appearing with the bootstrap style I put. Here is the form.py code:
class SearchForm(FlaskForm):
search = StringField('Número do protocolo', validators=[DataRequired()])
submit = SubmitField('Buscar')
Here is the .html code:
{% extends "base.html" %}
{% block sub_content %}
<br><br>
<form method="POST" action="">
{{ form.hidden_tag() }}
<fieldset class="form-group">
<legend class="border-bottom mb-4">Veja o andamento da sua denúncia</legend>
<div class="form-group">
{{ form.search.label(class="form-control-label") }}
{% if form.search.errors %}
{{ form.search(class="form-control is-invalid") }}
<div class="invalid-feedback">
{% for error in form.search.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.search(class="form-control") }}
{% endif %}
</div>
</fieldset>
<div class="form-group">
{{ form.submit(class="btn btn-secondary") }}
<a href="/client1/"><input type="button" value="Voltar" class="btn btn-secondary"></a>
</div>
</form>
{% endblock %}
Even though the html code has the error style shown below:
{% if form.search.errors %}
{{ form.search(class="form-control is-invalid") }}
<div class="invalid-feedback">
{% for error in form.search.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
It keeps showing the random error message in the image below: