Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Form: Field Type Options Guessing - can't guess maxlength if field already has attr #12444

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

Closed
EduardTrayan opened this issue Nov 10, 2014 · 2 comments
Labels

Comments

@EduardTrayan
Copy link

Hello,

I have a problem with guessing maxlength attribute if field definition has attr option. Please see below:

$builder
            ->add(
                'title',
                null,
                [
                    'attr' =>
                    [
                        'autocomplete' => 'off',
                        'data-display' => true,
                    ],
                ]
            );
.......

/**
     * Title
     *
     * @var string
     *
     * @ORM\Column(type="string", length=255, nullable=false)
     * @Assert\NotNull(groups={})
     * @Assert\Length(max=255, groups={})
     */
    private $title;

In this case I don't see maxlength attribute in html output, but if I declare field like this (without attr option):

$builder
            ->add(
                'title',
                null,
                [
                ]
            );

maxlength attribute appears in html output.

Could you please clarify this behavior.

Thanks in advance

@jakzal jakzal added the Form label Dec 6, 2014
@xelaris
Copy link
Contributor

xelaris commented Dec 27, 2014

I think this is a duplicate of #11527 and was fixed with PR #12548. So it should be fixed in the next release.

@jakzal
Copy link
Contributor

jakzal commented Dec 27, 2014

Indeed, looks like #12548 fixed merging attr options.

@jakzal jakzal closed this as completed Dec 27, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants