I am developing an app using Symfony 2 and using FOSUserBundle. I would like to know if it is possible to define my own form with my own custom field names. I know the Symfony 2 Security Component allows you to map the field names for the login route but I don't know of a way to do so with the register form. I want to have fields like name, email instead of fos_user_registration_form[email] etc. Do I need to write a custom controller to handle the user registration or is there a configuration section in the firewall I can modify?
Asked
Active
Viewed 580 times
0
das-g
- 9,718
- 4
- 38
- 80
Vesselin Obreshkov
- 1,087
- 11
- 26
-
that kind of long fieldnames are common in symfony. I wonder why you want to have shorter names? – Frank B Jun 22 '15 at 21:31
-
`fos_user_registration_form` is the name of the form in which the field `email` appears. While it is possible to override the form to enable a shorter name it is hard to see what advantage this provides. There is advantage in clearly identifying the form in which the field appears. – geoB Jun 22 '15 at 23:03
1 Answers
2
In the FOSUserBundle configuration, set fos_user.registration.form.name value to null or empty string (FOSUserBundle configuration reference).
Also see this question: Symfony2 Form Component - creating fields without the forms name in the name attribute
Community
- 1
- 1
Genti Saliu
- 2,643
- 4
- 23
- 43