5
votes

I'm using Symfony 2.1 for a project and FOSUserBundle to manage the users.

I'm trying to customize the change password form and I can't display well the error messages. Indeed, when an input is wrong filled, the error message is printed between the label and the input (with a list structure). But I like to display it after the input or below it.

Moreover, I'd like to display my change password form within a settings page so I need to display some other forms. How can I integrate this form in a precise place in a page?

Thanks in advance, Valentin

1
read symphony manual for this customization.Yogesh Suthar
@YogeshSuthar: the FOSUserBundle is separate from symfony.Layton Everson
@YogeshSuthar: I have already read this documentation and I successfully create my own template for the login page. But this documentation doesn't help me for this problem..ValentinH

1 Answers

2
votes

For my first question, I succeeded with this form for the change_password:

<form action="{{ path('fos_user_change_password') }}" {{ form_enctype(form) }} method="POST" class="fos_user_change_password">

<div class="form_errors_change_pwd">
    {{ form_errors(form) }}
</div>
<div>
    {{ form_label(form.current_password) }}
    {{ form_widget(form.current_password) }}
    <span class="form_error_field">{{ form_errors(form.current_password) }}</span>
</div>
<div>
    {{ form_label(form.new.first) }}
    {{ form_widget(form.new.first) }}
    <span class="form_error_field">{{ form_errors(form.new.first) }}</span>
</div>
<div>
    {{ form_label(form.new.second) }}
    {{ form_widget(form.new.second) }}
    <span class="form_error_field">{{ form_errors(form.new.second) }}</span>
</div>
{{ form_rest(form) }}
<div>
    <input type="submit" value="{{ 'change_password.submit'|trans({}, 'FOSUserBundle') }}" />
</div>

But I'm still trying to integrate this form inside another page with multiple forms...