W
W
wolverine7772021-03-16 23:16:42
Flask
wolverine777, 2021-03-16 23:16:42

How to display an invalid email notification?

Hello, I have an "email" field in my forms that is checked by the validator for "correctness". Everything works only "quietly" - but I would like if something went wrong (for example, they forgot to put the dog) - a notification was displayed - "put @" well, or something like that. Of course, this can be done as a separate function in the models with parsing the mail string and checking it for the necessary elements, but maybe these functions are already built into this validator and you shouldn’t fence the garden?

Thank you!

from flask_wtf import FlaskForm
from wtforms import StringField
from wtforms.validators import DataRequired, Email

class RegistrationForm(FlaskForm):
    email = StringField('Email: ',validators=[DataRequired(),Email()]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stefan, 2021-03-16
@MEDIOFF

Such validation is done at the front, and through JS, and verified data is already sent to the server.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question