Replies: 1 comment
-
Not sure to understand your issue; disabling the placeholder option should be enough? $builder->add('baseType', ChoiceType::class, [
'choices' => [ 'Item' => BaseItemType::ITEM, 'Weapon' => BaseItemType::WEAPON, 'Armor' => BaseItemType::ARMOR, ],
'placeholder' => 'Choose Item Type',
+ 'placeholder_attr' => ['disabled' => 'disabled']
'label_attr' => ['class' => 'ms-3']
]) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Using symfony 6.4 and PHP 8.2
I'm trying to create a choice type that has a default option "Choose Item Type" that is disabled so it can't be selected the moment any other option is chosen. But symfony is adding a selected option to the first non-disabled option in the selected, what am I doing wrong?
That's the Code I'm using at the moment:
->add('baseType', ChoiceType::class, [ 'choices' => [ 'Item' => BaseItemType::ITEM, 'Weapon' => BaseItemType::WEAPON, 'Armor' => BaseItemType::ARMOR, ], 'placeholder' => 'Choose Item Type', 'label_attr' => ['class' => 'ms-3'], ])
Beta Was this translation helpful? Give feedback.
All reactions