Skip to content

[Form] FixCheckboxInputListener loses sort order of submitted values #10575

@Richtermeister

Description

@Richtermeister

I am trying to make a checkbox list sortable, and retain the order of the submitted values on the server, but I noticed that the FixCheckboxInputListener always forces the submitted values back into the order of the original choices. In fact, this seems to be its specific purpose, but I'm not quite understanding why.

The specific code in question is this:
https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Form/Extension/Core/EventListener/FixCheckboxInputListener.php#L57

Also, a bit earlier in the code the comments indicate that due to performance considerations we would want to work with the array of submitted values, rather than all available choices, but the loop I'm referencing loops over the long array instead..

Please let me know if I am not understanding the purpose of this class right.. otherwise I would like to fix it to retain the original order of submitted values. Happy to submit the PR to this effect.

Thank you.

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