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

Skip to content

[Form] Render same field multiple times #26531

Closed
@ostrolucky

Description

@ostrolucky
Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? no
Symfony version 4.1

This is a common problem. Only workarounds exists is not using form_* functions for subsequent fields.

Wanted to solve this by doing

{{ form_row(form.save) }}
{% do form.save.setRendered(false) %}
{{ form_row(form.save) }}

quickly found setRendered does not accept arguments and PRs for multiple different use cases has been rejected1 in2 past3. Is this use case good enough for this change now?

This is specifically very useful to split form visually to two, where one block is just for RepeatedType and SubmitType. Here was the requirement from our designer

37027104-b990ff70-2130-11e8-9f2b-469c0a1c2b03

If I could render same field twice, I could reuse same button field and be done with it.

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