简体   繁体   中英

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:

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

Hope this help

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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