Reputation: 5602
is there a way to hide label from form field in symfony 4?. This is my coding.
$builder
->add('min', TextType::class, array('attr' => array(
'class' => 'min date',
'label' => false,
'required' => false,
'id' => 'min')))
->add('max', TextType::class, array('attr' => array(
'class' => 'max date',
'label' => false,
'id' => 'max')));
Even though I added 'label' => false,
label still appears.
Upvotes: 0
Views: 1517
Reputation: 4691
You have put in in the array of attr
where it does not belong. This works:
$builder
->add('min', TextType::class, array(
'label' => false,
'attr' => array(
'class' => 'min date',
'required' => false,
'id' => 'min')))
->add('max', TextType::class, array(
'label' => false,
'attr' => array(
'class' => 'max date',
'id' => 'max')));
Upvotes: 1