Karmo
Karmo

Reputation: 393

Symfony formbuilder: validate email domain?

it's possible on a email filed (form builder) to restric some domains like "@gmail.com"?

I want to acept only some email in registration form.

Upvotes: 0

Views: 1151

Answers (3)

Karmo
Karmo

Reputation: 393

Finally I haved tried to create a custom constrain validator like this:

https://stackoverflow.com/a/36452969/8526318

Upvotes: 1

Sebastian Tkaczyk
Sebastian Tkaczyk

Reputation: 372

Yes. It is possible. Try use Validation.

Upvotes: 0

One More Light
One More Light

Reputation: 175

You can first play with Symfony EmailValidator:

https://symfony.com/doc/current/reference/constraints/Email.html

Or you can use something like that, playing with custom constraint:

https://stackoverflow.com/a/36452969/8526318

Upvotes: 1

Related Questions