Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FOSUserBundle customize error message change_password

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

like image 503
ValentinH Avatar asked Nov 03 '22 14:11

ValentinH


1 Answers

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...

like image 88
ValentinH Avatar answered Nov 13 '22 21:11

ValentinH