Skip to content

Commit

Permalink
bug #23649 [Form][TwigBridge] Don't render _method in form_rest() for…
Browse files Browse the repository at this point in the history
… a child form (fmarchalemisys)

This PR was squashed before being merged into the 2.7 branch (closes #23649).

Discussion
----------

[Form][TwigBridge] Don't render _method in form_rest() for a child form

The hidden `_method` must only be generated if the form is the top most form.

Always generating the hidden `_method` breaks forms using the POST method when they have children using the PUT method. If `_method` is generated for such a child form, it overrides the parent method and the form fails to validate.

See issue #23254

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #14261
| License       | MIT
| Doc PR        |

Commits
-------

973b2d3 [Form][TwigBridge] Don't render _method in form_rest() for a child form
  • Loading branch information
ogizanagi committed Jul 25, 2017
2 parents ee58cfc + 973b2d3 commit 2af5959
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -303,7 +303,7 @@
{% endif %}
{%- endfor %}

{% if not form.methodRendered %}
{% if not form.methodRendered and form.parent is null %}
{%- do form.setMethodRendered() -%}
{% set method = method|upper %}
{%- if method in ["GET", "POST"] -%}
Expand Down

0 comments on commit 2af5959

Please sign in to comment.