What is the difference between form.validate_on_submit()
and form.validate()
?
In the Flask WTF docs, the author uses form.validate_on
validate_on_submit()
is a shortcut for is_submitted() and validate()
.
From the source code, line 89, is_submitted()
returns True if the form submitted is an active request and the method is POST, PUT, PATCH, or DELETE.
Generally speaking, it is used when a route can accept both GET and POST methods and you want to validate only on a POST request.