douh9817 2016-04-01 14:31
浏览 15
已采纳

在尝试单独加载时,表单仍然呈现整体

So I am making a form for a customer add. I want to load in the labels and texts seperate, so I can later on add tooltips and helper text easily meaning this:

{{ form_start(form) }}
{{form_label(form.firstname)}}{{ form_widget(form.firstname) }} 

{{form_label(form.lastname)}}{{ form_widget(form.lastname) }} 

{{form_label(form.email)}}{{ form_widget(form.email) }} 

{{ form_end(form) }}

However when i am rendering this and checking it the entire form still gets displayed even fields not loaded in. Anybody knows how this happened or did I make an obvious mistake?

  • 写回答

1条回答 默认 最新

  • duanlan3598 2016-04-01 15:03
    关注

    If you don't want to render all element defined in the form you can use the form_end with the render_rest with false value as described in the doc.

    As Example:

    {# don't render unrendered fields #}
    {{ form_end(form, {'render_rest': false}) }}
    

    Remember to render the _token element if your use it in your form.

    Hope this help

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料