简体   繁体   中英

Twig/Symfony not rendering form_widget

I have a twig template ( home.twig ), and I'm using

{{ render(controller('WebsiteUserBundle:Registration:register',{ 'template': 'popup'} )) }}

inside that template to render another template ( login.twig ), which is used to login the user from a popup.

The problem is that the form_widget isn't rendered, but the form_label is.

This is part of my login template:

<div class="row-fluid">
    {{ form_label(form.email, 'Email:')}}
    {{ form_widget(form.email, { 'attr': {'class': 'span12'} }) }}
</div>

And by "it's not rendered", I mean that there isn't even an empty div or input next to the label element in the DOM.

Why is this happening?

if you get only form_widget without extra params, like this :

{{ form_widget(form.email) }}

do you have more informations or any output ?

I had the same issue and was because I had the follow sentence before the form_widget

{{ form_rest(form) }}

Check that the form_rest be after of all your form_widget.

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