Determine why WTForms form didn't validate
<p>I called <code>form.validate_on_submit()</code>, but it returned <code>False</code>.  How can I find out why the form didn't validate?</p>

<p>For the whole form, <code>form.errors</code> contains a map of fields to lists of errors.  If it is not empty, then the form did not validate.  For an individual field, <code>field.errors</code> contains a list of errors for that field.  The list is the same as the one in <code>form.errors</code>.</p>

<p><code>form.validate()</code> performs validation and populates <code>errors</code>.  When using Flask-WTF, <code>form.validate_on_submit()</code> performs an additional check that <code>request.method</code> is a "submit" method, which mostly means it is not a <code>GET</code> request.</p>

python flask wtforms flask-wtforms