显示错误消息表单

时间:2016-12-11 14:47:04

标签: forms symfony passwords

我正在尝试在我的树枝视图中的页面顶部显示错误消息,但{{Form_errors(form)}}不显示密码错误!但显示其他错误..

Form builder

->add('password', RepeatedType::class, array(
            'type' => PasswordType::class,
              'options' => array('attr' => array('class' => 'password-field')),
              'required' => true,
              'first_options'  => array('label' => 'Password'),
              'second_options' => array('label' => 'Repeat Password').


view :

{% extends 'base.html.twig' %}

{% block body %}


    {{ form_start(form) }}
          {{ form_widget(form) }}`enter code here`
{{dump(form_errors(form))}}
        <input type="submit" value="Create" />
    {{ form_end(form) }}

1 个答案:

答案 0 :(得分:0)

尝试

{{dump(form_errors(form.password))}}

显示特定于密码字段的错误