禁用属性在单选按钮上的symfony中不起作用

时间:2017-05-27 06:00:59

标签: symfony

这是我的属性

        ->add(
            'target',
            DaimChoiceType::class,
            [
                'required' => true,
                'disabled' => $this->disabledStatus(),
                'label' => 'attr.target',
                'choices' => [
                    'common_settings.ui.yes' => 1,
                    'common_settings.ui.no' => 0,
                ],
                'label_attr' => ['class' => 'radio-inline health-target-radio'],
                'expanded' => true,
                'multiple' => false,
            ]
        )

这是我的代码

    {% if viewMode is defined %}
        {% set disabled = {'attr':{'disabled': 'disabled'}} %}
    {% endif %}

{{ form_row(form.healthInsuranceType.target, disabled) }} // disabled attribute not working here

{{ form_row(form.healthInsuranceType.issueDate, disabled) }} //disabled attribute working here 

请帮我解决symfony中的问题

0 个答案:

没有答案