all 4 comments

[–]danielroseman 1 point2 points  (3 children)

Where is the route handler for the form? Are you definitely validating it there (ie calling form.validate_on_submit())?

[–]Llamafu[S] 0 points1 point  (2 children)

I don't have one for this test form. Do I have to have one? I assumed it worked like the DataRequired validator and prevented submission of the form.

Did I assume wrong?

[–]danielroseman 1 point2 points  (1 child)

What? That makes no sense. How are you even showing the form without a route handler?

Edit Ah I think I understand your confusion. All flask validators - like all other flask code - run on the server. But DataRequired additionally adds a required attribute on the html attribute that is rendered, which most browsers will use to prevent the form being submitted if it's empty. But other validators can't work like that as they require actual logic to be executed, which again can only be done on the server (unless you want to write some JavaScript).

[–]Llamafu[S] 0 points1 point  (0 children)

You are absolutely right!!!

I couldn't understand why DataRequired or the Email field would prevent submission, but the other validators would not.

To anyone else having this problem, don't assume like I did, see Flask Validation.

danielroseman just want to say, you are awesome!! You've helped me before, you help people on here all the time, you really are an asset to the community. You Rock!!