-1

Based on this documentation of MDB: https://mdbootstrap.com/docs/jquery/forms/select/

I have created this form

 public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('categorie', EntityType::class, [
            // This field shows all the categories
            'class'    => Categorie::class,
            'Placeholder' => 'Select choice',
            'mapped' => false,
            'multiple' => true,
            'attr' => ['class' => 'mdb-select']
            ])

Like what i have coded i want to see 'Select choice' in place holder But this the result in picture :

enter image description here

My probleme is i see directly the resulat of class Categorie, but at first i need to see the placeholder!

Any solutions please?

PS: My question is not duplicate to this : How to add placeholder on input in Symfony 4 form?

because i'm use MaterialDesignBootstrap and not bootstrap, i have used placeholder like the response of that question and not work.

Community
  • 1
  • 1
Khalil
  • 288
  • 3
  • 16
  • 1
    Possible duplicate of [How to add placeholder on input in Symfony 4 form?](https://stackoverflow.com/questions/55707663/how-to-add-placeholder-on-input-in-symfony-4-form) – gp_sflover Apr 20 '19 at 22:27
  • @gp_sflover No duplicated because in my case, i use MaterialDesignBootstrap and not bootstrap, i'm used placeholder and is not work – Khalil Apr 20 '19 at 22:31

2 Answers2

0
$builder
        ->add('categorie', EntityType::class, [
        // This field shows all the categories
        'class'    => Categorie::class,
        'placeholder' => 'Select choice',
        'mapped' => false,
        'multiple' => true,
        'required' => false,
        'attr' => [
            'class' => 'mdb-select',
            'placeholder' => 'test',
         ]
        ])

Tell me if it's ok

Heyden7611
  • 174
  • 2
0

Ok and if you do

$builder
    ->add('categorie', EntityType::class, [
    // This field shows all the categories
    'label' => 'test for categories',
    'class'    => Categorie::class,
    'placeholder' => 'Select choice',
    'mapped' => false,
    'multiple' => true,
    'required' => false,
    'attr' => [
        'class' => 'mdb-select',
     ],
    'label_attr' => [
        'class' => 'mdb-main-label',
     ]
    ]);
Heyden7611
  • 174
  • 2