Form::isValid() returning true despite invalid EmailType value #44055
-
I have a form type like this:
Then in my controller:
My problem is that, when I submit the form, no matter what I enter into the Email field (e.g. "xlsjdjsblsjd" with no "@" in it), I tried changing the type for the What am I missing? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @php4fan, I think you are confusing 2 things which are separated in Symfony : Actually |
Beta Was this translation helpful? Give feedback.
-
I see. But on the other hand, an Why? What is the good reason behind that distinction? |
Beta Was this translation helpful? Give feedback.
Hi @php4fan, I think you are confusing 2 things which are separated in Symfony :
FormTypes and Constraints.
Actually
EmailType
has no default Constraint for email validation. If you want that, you have to add yourself anEmail
constraint on yourEmailType
.