表单错误显示两次

时间:2017-06-09 07:43:38

标签: php forms symfony sylius

我有一个表单来更改用户密码。
当密码不相同时,错误消息会显示两次。

这是我的代码:

<div class="input-icon">
   <i class="fa fa-lock"></i>
   {{ form_widget(form.currentPassword, {'attr':{'type': 'text', 'class': 'form-control placeholder-no-fix', 'autocomplete': 'off', 'placeholder': 'sylius.form.user_change_password.current'|trans, 'name': 'current'}} ) }}
   {{ form_errors(form.currentPassword) }}
</div>

这是结果

enter image description here

主题:

{%- block form_errors -%}
    {%- if errors|length > 0 -%}
        {%- for error in errors -%}
            <div class="ui red {% if form.parent is not empty %}pointing {% endif %}label sylius-validation-error"{% if form.parent is empty %} style="margin-bottom: 10px;"{% endif %}>
                {{ error.message }}
            </div>
        {%- endfor -%}
    {%- endif -%}
{%- endblock form_errors -%}

0 个答案:

没有答案