Reputation: 13
I have a serious issue with Symfony2. I build up a form and the problem is when I just use the instruction: {{form_widget(form)}} everything works fine. But with this instruction the form doesn't look nice so I changed it to the following code:
<form action="{{ path('fos_user_registration_register_employee') }}" {{ form_enctype(form) }} method="POST" class="fos_user_registration_register_employee">
<table><tr><div class="form-group">
<td class="register">{{ form_label(form.salutation, 'Anrede') }}</td>
<td>{% for choiceFormView in form.salutation %}
{{ form_label(choiceFormView) }}
{{ form_errors(choiceFormView) }}
{{ form_widget(choiceFormView) }}
{% endfor %}</td>
</div></tr>
<tr>
<div class="form-group">
<td class="register">{{ form_label(form.title, 'Titel') }}</td>
<td>{{ form_errors(form.title) }}
{{ form_widget(form.title) }}</td>
</div>
</tr>
<tr>
<div class="form-group">
<td class="register">{{ form_label(form.nameEmployee, 'Vorname') }}</td>
<td>{{ form_errors(form.nameEmployee) }}
{{ form_widget(form.nameEmployee) }}</td>
</div>
</tr>
<tr><div class="form-group">
<td class="register">{{ form_label(form.surnameEmployee, 'Nachname') }}</td>
<td>{{ form_errors(form.surnameEmployee) }}
{{ form_widget(form.surnameEmployee) }}</td>
</div></tr>
<tr><div class="form-group">
<td class="register">{{ form_label(form.phone, 'Telefon') }}</td>
<td>{{ form_errors(form.phone) }}
{{ form_widget(form.phone) }}</td>
</div></tr>
<tr><div class="form-group">
<td class="register">{{ form_label(form.email, 'E-Mail') }}</td>
<td>{{ form_errors(form.email) }}
{{ form_widget(form.email) }}</td>
</div></tr>
<tr><div class="form-group">
<td class="register">{{ form_label(form.username, 'Username') }}</td>
<td>{{ form_errors(form.username) }}
{{ form_widget(form.username) }}</td>
</div></tr>
<tr><div class="form-group">
<td class="register">{{ form_label(form.plainPassword, 'Passwort') }}</td>
<td>{{ form_errors(form.plainPassword) }}
{{ form_widget(form.plainPassword) }}</td>
</div></tr>
<tr><td colspan="2">{{ form_label(form.jobObjectCreation, 'Berechtigungen') }}</td></tr>
<tr><div class="form-group">
<td class="register">{{ form_label(form.folderCreation, 'Ordner') }}</td>
<td>{% for choiceFormView in form.folderCreation %}
{{ form_label(choiceFormView) }}
{{ form_errors(choiceFormView) }}
{{ form_widget(choiceFormView) }}
{% endfor %}</td>
</div></tr>
<tr><div class="form-group">
<td class="register">{{ form_label(form.jobObjectCreation, 'Job Objekte') }}</td>
<td>{% for choiceFormView in form.jobObjectCreation %}
{{ form_label(choiceFormView) }}
{{ form_errors(choiceFormView) }}
{{ form_widget(choiceFormView) }}
{% endfor %}</td>
</div></tr>
</table>
<div>
<input type="submit" value="{{ 'registration.submit'|trans({}, 'FOSUserBundle') }}" />
</div>
</form>
The thing is, when I press the Register button, the form seems to be proceeded, there is no error message. The only thing is, that the successful page is not shown an nothing is written to the database. So, please can you help me? Is there someting missing? If you need more information, please tell me, so I can show you more code.
Cheers Roger
Upvotes: 0
Views: 670
Reputation: 2639
Please add
{{ form_rest(form) }}
at the end of the table and check if this helped.
Upvotes: 1