Topic: Probleme Placeholder select input with symfony

Khaliltr free asked 5 years ago


I'm using Mdb pro 4.7.6 I have created formtype with this code

->add('categorie', EntityType::class, [ 'placeholder' => 'select option', 'class' => Categrorie::class, 'mapped' => true, 'multiple' => true ]);

the probleme is i see the select form with data of Categorie list, but i dont see the placeholder "select option"

whats the solution please?


Bartłomiej Malanowski staff commented 5 years ago

Currently, we don't offer integration with Symfony. However, some people did it so maybe someone will be able to answer your question


Khaliltr free commented 5 years ago

ok thank you...


Khaliltr free commented 5 years ago

when multiple = false placeholder its work, but when multiple=true, placeholder not work , and i see the first index :/


Khaliltr free commented 5 years ago

@Bartłomiej Malanowski Please look my answer in the bottom of this Topic


Khaliltr free answered 5 years ago


I have found an solution ( until find another solution):

I have added placeholder in this line (mdb.min.css) :

this.$materialSelect = $("<............. placeholder="Choissisez une option" type=\"text\" class=\"select-dropdown\" .................;.>"));

And change this line

this.$materialSelect.val(sanitizedLabelHtml);

to this line:

this.$materialSelect.val("");

and now placeholder work good,

but i have question, Can i do all this changes in my own custum js and not in mdb.min.js?

for example ;

('select').materialSelect.val("");

// ps i have did this but not work , have you another suggestion?



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: Windows
  • Browser: Chrome
  • OS: WIN8
  • Provided sample code: No
  • Provided link: No