【问题标题】:Required not working in my form with easyAdmin要求不能使用 easyAdmin 在我的表单中工作
【发布时间】:2021-05-27 08:29:56
【问题描述】:

我的 EasyAdmin 中有一个 CollectionField,在 setEntryType 中有我的 ExtraType => ->setEntryType(ExtraType::class)。 在我的 ExtraType 中,我选择 3 上的 2 个字段来获得所需的 true,最后一个字段为 false,但所需的不起作用:

public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder
            ->add('description', TextareaType::class, [
                'required' => true
            ])
            ->add('isVisible', CheckboxType::class, [
                'label' => 'Visible',
            ])
            ->add('createdAt', DateTimeType::class, [
                'widget' => 'single_text',
                'label' => 'Date',
                'required' => true
            ])

        ;
    }

不知道为什么 dom 中没有出现 required

【问题讨论】:

    标签: symfony easyadmin


    【解决方案1】:

    我找到了答案,我就是这样做的:
    'attr' => ['required' => true]

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-08
      • 2015-07-11
      • 2019-06-22
      • 2019-12-26
      • 2018-04-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多