如何使form_rest()不显示Symfony2的字段? [英] How to make form_rest() not display a field with Symfony2?
本文介绍了如何使form_rest()不显示Symfony2的字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经开始使用Symfony2,但是我遇到了一些问题。
我想手工绘制字段,但它不起作用,因为我的字段已经被 form_rest()
函数显示,所以我有两个相同的字段。
这是我的代码:
< DIV>
{{form_errors(form.contenu)}}
< / div>
而且,在表格的结尾处,我必须写下:
{{form_rest(表单)}}
<但是它会显示contenu字段:(b / b)
您是否知道问题所在?
{%do form.contenu.setRendered%}
I've started to use Symfony2 but I've some problems.
I wanted to render fields by hand but it doesn't work because my field yet rendered by me is displayed with the form_rest()
function too, so I have two same fields.
Here is my code :
<div>
{{ form_errors(form.contenu) }}
<textarea id="{{ form.contenu.vars.id }}" name="{{ form.contenu.vars.full_name }}">{{ form.contenu.vars.value }}</textarea>
</div>
And, at the form's end, I must put this :
{{ form_rest(form) }}
But it displays the "contenu" field :(
Do you have an idea of what's the problem ?
解决方案
Another option is to explicitly mark the field as rendered:
{% do form.contenu.setRendered %}
这篇关于如何使form_rest()不显示Symfony2的字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文