Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2af5959

Browse files
committed
bug #23649 [Form][TwigBridge] Don't render _method in form_rest() for 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
2 parents ee58cfc + 973b2d3 commit 2af5959

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@
303303
{% endif %}
304304
{%- endfor %}
305305

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

0 commit comments

Comments
 (0)