Skip to content

Stop override "required" in child fields when setting required false to a CollectionType #41368

@VincentLanglet

Description

@VincentLanglet

Description
There is often a * added by CSS used in order to tell if a field is required or not.

When I use a CollectionType, I do not want this * since adding a row to the collection is not required
image
The * could be considered more like telling that at least one row should be added.

But if I use required => false on the CollectionType, I lose the required attribute on all the children
image
Become
image
And I'm looking for
image

As explained in Follow up of #39943
It's a general rule for Form and child, but it seems weird for Collection.

Maybe the rule issue is with the required attribute of a CollectionType.
To me, it does not have a lot of sens, what is a required CollectionType vs a non required CollectionType ?
Both will submit a collection.

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