Probleme Placeholder select input with symfony


Topic: Probleme Placeholder select input with symfony

Khaliltr asked 6 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 pro premium commented 6 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 commented 6 years ago

ok thank you...


Khaliltr commented 6 years ago

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


Khaliltr commented 6 years ago

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


Khaliltr answered 6 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
  • User: Free
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: Windows
  • Browser: Chrome
  • OS: WIN8
  • Provided sample code: No
  • Provided link: No