Form does not display form errors in template

£可爱£侵袭症+ 提交于 2019-12-04 19:33:47

Can you confirm that the validation is working with this:

if ($form->isValid()) {
//Do something
}
else
{ die('not valid') }

Is the form well posted?

Is there anything in the HTML that shows up where you call {{ form_errors(form) }} ? - it would be a CSS or JS problem if that's the case...

Have you tried to show the errors by field (there is no global error in your validation apparently):

{{ form_errors(form.firstName) }}
etc.

Remark: form.firstName works, not form.first_name. You have to follow that convention with Doctrine2/Symfony2.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!