Skip to content

[Form] Choice value get trimmed and throw Invalid value error #24247

Closed
@alexander-schranz

Description

@alexander-schranz
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? yes/no
Symfony version 2.8 (think newer versions also affected)

When you have a choice which has whitespaces in its values:

$options['choices'] = [
    'test with whitespace ' => 'test with whitespace ',
]

The TrimListener will trim the whitespace but the Validator will throw Invalid value test with whitespace submitted.

Possible Solutions

When the option trim is true the values of the choice should also been trimmed.

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