2011-10-04 80 views
3

我有以下更改密碼的形式,它覆蓋從FOSUserBundle的窗體。如果我再次輸入一個不匹配的密碼/重複密碼,表單顯示沒有任何錯誤和不重定向爲什麼我的錯誤不會出現在Symfony2表單上?

<div id="change_password_wrapper"> 
    <h2>Change your password</h2> 
    <form action="{{ path('fos_user_change_password') }}" {{ form_enctype(form) }} method="POST" class="fos_user_change_password"> 
    {%if form_errors(form)%} 
    <div class="ui-state-error ui-corner-all"> 
     <p> 
     <span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span> 
<strong>Error:</strong> 
     {{ form_errors(form) }} 
     </p> 
    </div> 
    {% endif %} 
     <div class="form-row"> 
      {{ form_label(form.current, 'Current password: ') }} 
      {{ form_errors(form.current) }} 
      {{ form_widget(form.current) }} 
     </div> 
     <div class="form-row"> 
      {{ form_label(form.new.first, 'New password: ') }} 
      {{ form_errors(form.new.first) }} 
      {{ form_widget(form.new.first) }} 
     </div> 
     <div class="form-row"> 
      {{ form_label(form.new.second, 'Verify password: ') }} 
      {{ form_errors(form.new.second) }} 
      {{ form_widget(form.new.second) }} 
     </div> 
     <div class="form_row"> 
      <input type="submit" value="{{ 'change_password.submit'|trans({}, 'FOSUserBundle') }}" /> 
     </div> 
    {{ form_rest(form) }} 
    </form> 
</div> 

回答

0

你也應該添加到您的形式:

{{ form_errors(form.new) }} 

現在你應該有錯誤訊息