0

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) }}&nbsp;
                            {% 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) }}&nbsp;
                            {% 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) }}&nbsp;
                            {% 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

1 Answer 1

1

Please add

{{ form_rest(form) }} 

at the end of the table and check if this helped.

Sign up to request clarification or add additional context in comments.

2 Comments

That was it! Now, I have another problem. When I press the register button and something is wrong in the checks the URL is changed from: localhost/jpp/web/app_dev.php/company/toblerag/employee to localhost/jpp/web/app_dev.php/register/register/employee which is a serious problem for me, as I grap some infomration out of the URL. What can I do to prevent this change? Thanks for the answer! Roger
is it similar to action="{{ path('fos_user_registration_register_employee') }}"?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.