Skip to content

[Form] Additional hints when rendering the same form in different templates #16284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 8, 2022

Conversation

kschrenk
Copy link
Contributor

There is the following tip mentioned in the documentation (see chapter 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.

@xabbuh
Copy link
Member

xabbuh commented Dec 15, 2021

I think we should rather delete the whole tip. Using a sub request for this doesn’t seem like a good practice to me.

@javiereguiluz javiereguiluz added this to the 5.4 milestone Aug 8, 2022
@carsonbot carsonbot changed the title Additional hints when rendering the same form in different templates [Form] Additional hints when rendering the same form in different templates Aug 8, 2022
@javiereguiluz javiereguiluz changed the base branch from 6.0 to 5.4 August 8, 2022 15:44
@javiereguiluz javiereguiluz merged commit 9626606 into symfony:5.4 Aug 8, 2022
@javiereguiluz
Copy link
Member

While merging I did what @xabbuh recommended and I removed the tip entirely. @kschrenk thanks for your contribution, because it helped us reevaluate the need for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants