I called form.validate_on_submit()
, but it returned False
. How can I find out why the form didn't validate?
For the whole form, form.errors
contains a map of fields to lists of errors. If it is not empty, then the form did not validate. For an individual field, field.errors
contains a list of errors for that field. The list is the same as the one in form.errors
.
form.validate()
performs validation and populates errors
. When using Flask-WTF, form.validate_on_submit()
performs an additional check that request.method
is a "submit" method, which mostly means it is not a GET
request.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.