1

In a Flask form, I have a form field that has a data validator and url validator.

url = URLField('url', validators=[DataRequired(), url()])

I have the page display an error message under the field using {{ for error in form.url.errors }} after a page reload.

When the field is empty, the error correctly appears as "This field is required." after a page reload.

But when the field has an invalid URL, instead, I receive a small popup/tooltip "Please enter a URL." without a reload.

If I change the form field to StringField, then the url validation error correctly renders as "Invalid URL." the same way as as the DataRequired() validator behavior.

Can I somehow suppress or skip this URLField popup error? Or is the solution to use StringField instead?

  • As a general rule, HTML5 elements validation cannot be skipped - you can add the `novalidate` attribute to the form to turn off all client-side validation or you can use a `String` field. – Sean Vieira Jan 08 '15 at 21:49

0 Answers0