helloflask / bootstrap-flask

Bootstrap 4 & 5 helper for your Flask projects.
https://bootstrap-flask.readthedocs.io
Other
1.1k stars 189 forks source link

form_errors are not displayed #281

Open neilmcguigan opened 1 year ago

neilmcguigan commented 1 year ago

WTForms form_errors are form-wide (non-field) error messages

These are not displayed by render_form()

An example, say you wanted to validate that username and password are not the same...this would be a form-error and not an error specific to a given field

Could add something like this near the top of the form:

    {% if form.form_errors %}
    <div class="alert alert-danger" role="alert"><ul>
    {% for error in form.form_errors %}
        <li>{{error}}</li>
    {% endfor %}
    </ul></div>
    {% endif %}