简体   繁体   English

FOSUserBundle自定义错误消息change_password

[英]FOSUserBundle customize error message change_password

I'm using Symfony 2.1 for a project and FOSUserBundle to manage the users. 我正在使用Symfony 2.1作为项目​​,使用FOSUserBundle来管理用户。

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 在此先感谢,Valentin

For my first question, I succeeded with this form for the change_password: 对于我的第一个问题,我使用此表单成功更改了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... 但我仍在尝试将此表单集成到具有多个表单的另一个页面中...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM