Reputation: 1231
With my form builder I have an email field set up like this:
->add('email', 'email', (array(
'label' => 'correo electrónico',
'translation_domain' => 'SonataUserBundle',
'attr' => array(
'placeholder' => 'correo electrónico',
),
)))
So lets say a user enters his value in the email field:
test - I get message to include @. Everything is fine here
test@ - it asks me to enter the following part of @. Everything is fine
test@ttt - he thinks this is a valid email and creates a user.
Instead it should give an error of an invalid email.. It should only accept atleast with .com or something... Is it possible to do in formbuilder? I want to make this in less code, js, as possible..
Upvotes: 0
Views: 84
Reputation: 1223
The EmailType field is a text field that is rendered using the HTML5 tag. So it is validated by a browser only. You should validate this field using Email Validation Constraint
Upvotes: 3