Skip to content

[Form] prototype "required" option is inconsistent with the default option #18311

@sergeyfedotov

Description

@sergeyfedotov

Seems like this issue is related to #15544

class PhotoType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('title', TextType::class);
    }

    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults([
            'data_class' => Photo::class,
            'required' => false
        ]);
    }
}

Actual result:

<input type="text" id="news_photos___name___title" name="news[photos][__name__][title]" required="required" class="form-control" />

Prototype is rendered with the "required" option. The explanation of this behavior is given in the comment #15544 (comment)

Is it possible to fix it?

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy