(I’m using Symfony2) I have a form that asks for the name and the firstnname and also the email address.
The email address is always on the same pattern : firstname.name@mycompany.com
For example, I would like that when the user for example enters ‘John’ for the first name and ‘Adams’ for the last name, the email address be set to : ‘john.adams@mycompany.com’ by default (but it should not be disabled because it can change sometimes a little, if the user has complex names etc. …).
I have never done such a thing and I’m stuck with this problem I don’t manage to solve although maybe it is simple.
Any help would be much appreciated
Thanks a lot
Im think there is many ways :
Solution 1 :
In the entity
Solution 2 :
In the controller
Solution 3 :
you can do it directly in javascript (with jquery it’s easy)
you put event on Keyup to generate the email field.