Skip to content

[Form] max option of Length Constraint has no effect #11527

Closed
@kl3ryk

Description

@kl3ryk

I have the following entity property:

    /**
     * @var string
     *
     * @ORM\Column(name="headline", type="string", length=128)
     * @Assert\NotBlank()
     * @Assert\Length(min="5", max="128")
     */
    private $headline;

form component generate the following html:

<input type="text" id="xxx_headline" name="xxx[headline]" required="required" pattern=".{5,}">

I suppose the fix should be done here: https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php#L223

There also could be added maxlength html option.

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