gpt4 book ai didi

php - Symfony2 表格 : How to display all the errors?

转载 作者:可可西里 更新时间:2023-10-31 23:09:47 26 4
gpt4 key购买 nike

我想一起打印所有验证错误,而不是每个字段旁边的每个错误。

但是 form_errors(form) 不工作。

我可以打印单个错误,所以我想我可以为每个字段使用 form_errors(form.some_field)。问题是它会打印类似“此字段不能为空”的错误,除非紧挨着该字段,否则这是没有意义的。

有什么想法吗?

最佳答案

您应该查看 error_bubbling 字段属性。如果将该属性设置为 true,则该字段的任何错误都将传递给父字段或表单。

例如,如果在普通字段上设置为 true,则该字段的任何错误都将附加到主表单,而不是特定字段。

关于php - Symfony2 表格 : How to display all the errors?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7375744/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com