开发者

Symfony2 Form: How to display all the errors?

I want to print all the validation errors together, and not each error next to each field.

But form_errors(form) isn't working.

I can print individual errors, so I thought I could just use form_errors(form.some_field) for each field. The problem is that it prints errors like 'This field cannot be blank', which is meaningless unless it is next 开发者_如何学Cto the field.

Any thoughts?


You should look the error_bubbling field property. If you set that property true, any errors for this field will be passed to the parent field or form.

For example, if set to true on a normal field, any errors for that field will be attached to the main form, not to the specific field.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜