Skip to content

Twig widget form_rest() should also render hidden field _method if not yet rendered. #14261

Closed
@Mondane

Description

@Mondane

I have a form with the method set to PUT which I custom render in a template, ie. I'm not using

{{ form(form) }}

or

{{ form_start(form) }}
{{ form_widget(form) }}
{{ form_end(form) }}

I do it more or less like this:

<form>
  {{ form_errors(form) }}
  {# render the columns in a way I need #}
  {{ form_rest(form) }}
</form>

I believed adding the form_rest(form) was enough to make sure non-rendered fields were added (like the _token). It turns out, the hidden field _method, isn't rendered unless you use form_start().

Shouldn't it be logical to have the form_rest also render the _method field if it isn't rendered so before?

The file that's rendering the form:

https://github.com/symfony/symfony/blob/2.7/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions