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

Skip to content

[Form] Non Nested field names in form child #29122

Closed
@Seb33300

Description

@Seb33300

I am using child forms to prevent code duplication as explained here: https://symfony.com/doc/current/form/inherit_data_option.html

But this result in "nested" fields names for child forms (foo[address], foo[zipcode], etc...).

In a classical web application, this is not a problem because Symfony render form HTML and we don't really care about fields names.
But when using it for an API application, we want all the request parameters as the same level and not in a nested sub level.

Actually it's possible to set an empty form name on the root form only.
Why can't we make it possible on child forms too?

Maybe another way exists to add field of a form type we want to include in our form at the same level of the current form?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions