Skip to content

Commit 9626606

Browse files
committed
minor #16284 [Form] Additional hints when rendering the same form in different templates (kschrenk)
This PR was submitted for the 6.0 branch but it was squashed and merged into the 5.4 branch instead. Discussion ---------- [Form] Additional hints when rendering the same form in different templates There is the following tip mentioned in the documentation (see chapter [Processing forms)](https://symfony.com/doc/current/forms.html#processing-forms): ``` If you need to render and process the same form in different templates, use the render() function to embed the controller that processes the form: {{ render(controller('App\\Controller\\TaskController::new')) }} ``` In my point of view this can lead to extra work especially when it comes to validation and rendering error messages. So my proposal is to add a hint like ``` But be careful because this might cause some extra work when it comes to submit and error handling. Symfony Validation will get more complex when you render the same form in different routes. ``` <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/releases for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `5.x` for features of unreleased versions). --> Commits ------- 6092143 [Form] Additional hints when rendering the same form in different templates
2 parents e9291f0 + 6092143 commit 9626606

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

forms.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,9 @@ possible paths:
455455
.. code-block:: twig
456456
457457
{{ render(controller('App\\Controller\\TaskController::new')) }}
458+
459+
But be careful becaues this might cause some extra work when it comes to submit and error handling.
460+
Symfony Validation will get more complex when you render the same form in different routes.
458461

459462
.. _validating-forms:
460463

0 commit comments

Comments
 (0)