-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] max option of Length Constraint has no effect #11527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Well, in ValidatorTypeGuesser, the lines from 191 to 195 should add the |
Ok i have tested it and with the following entity properites /**
* @var string
*
* @ORM\Column(name="position", type="string", length=128, nullable=true)
*/
private $position;
/**
* @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="x_position" name="x[position]" maxlength="128">
<input type="text" id="x_headline" name="x[headline]" required="required" pattern=".{5,}"> So i suppose that |
I have also tested /**
* @var string
*
* @ORM\Column(name="position", type="string", length=128, nullable=true)
* @Assert\Length(max="128")
*/
private $position; and result is still <input type="text" id="x_position" name="x[position]" maxlength="128"> So if I will use both |
This PR was squashed before being merged into the 2.5 branch (closes #12548). Discussion ---------- [Form] fixed a maxlength overring on a guessing | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #11527 | License | MIT | Doc PR | - Commits ------- 7248680 [Form] fixed a maxlength overring on a guessing
I have the following entity property:
form component generate the following html:
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.The text was updated successfully, but these errors were encountered: