简体   繁体   English

Symfony 3阻止完整形式的渲染树枝

[英]Symfony 3 prevent full form rendering twig

I'm currently trying to only render specific parts of a form but for some reason, the whole form keeps getting rendered as you can see below I've used the form start and end and the whole form is still being rendered even though it should only render the start and end of the form tags. 我目前仅尝试呈现表单的特定部分,但是由于某种原因,整个表单一直在被呈现,如下所示,我使用了表单的开始和结尾,尽管应该将整个表单呈现出来仅呈现表单标签的开始和结束。

        {{ form_start(searchForm) }}

        {{ form_end(searchForm) }}

Also whenever I use the code below all that happens is that the elements are being moved to the top of the form and the elements which shouldn't be rendered are rendered below. 同样,每当我使用下面的代码时,所有发生的事情都是将元素移到表单的顶部,不应该呈现的元素在下面呈现。

        {{ form_start(searchForm) }}
          {{ form_widget(searchForm.title) }}
          {{ form_widget(searchForm.title) }}
        {{ form_end(searchForm) }}

As described in the doc , for don't render unrendered fields: doc中所述,请勿渲染未渲染的字段:

{{ form_end(form, {'render_rest': false}) }}

Hope this help 希望有帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM