question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dynamic placeholders for Multi-select no longer working in 9.x

See original GitHub issue

Describe the bug In all versions <= 8.0.0, placeholders would show up for multiple select dropdown configurations. This is no longer working in the 9.x branch.

To Reproduce Steps to reproduce the behavior:

  1. Add a new multi-select with no initial options.
  2. Use the following code to add placeholder.
<select id="myselect"></select>
new Choices(document.getElementById('myselect'), {
  placeholderValue: 'This should be a placeholder'
});

Expected behavior You should see the placeholder.

Screenshots Will provide if necessary but this is pretty easy to reproduce.

Desktop (please complete the following information):

  • MacOS, Chrome

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:3
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
jshjohnsoncommented, Nov 29, 2019

Hey - so I actually removed this functionality in the 9.0.0 release (https://github.com/jshjohnson/Choices/pull/731) but have clearly forgotten to update the documentation 🤦‍♂For versions >=9.x, placeholderValue will only apply to text elements. The reason for removing it was the added complexity of supporting it.

0reactions
evenfrostcommented, Apr 22, 2020

@travist thanks. I’ve ended with dumb’n’brute solution (using Preact):

  useEffect(() => {
    const choices = new Choices(selectRef.current, options as IChoices.Options);
    
    if (restProps.multiple && choices.config.placeholderValue) {
      ((choices as any).input as HTMLInputElement).placeholder = choices.config.placeholderValue;
    }
  }, []);
Read more comments on GitHub >

github_iconTop Results From Across the Web

Problem with adding options dynamically to multiselect
1. You probably need to re-initialize whatever it was that turned your select element into such a custom HTML structure to begin with....
Read more >
Static array not loading in dropdown - No Data Available ...
Angular version: 9.0.4 ; ng-multiselect-dropdown version: 0.2.10 ; Description of issue: Static arrays are not loading - Dynamic array is loading.
Read more >
Placeholders - The jQuery replacement for select boxes
Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and pagination (infinite scrolling) of results.
Read more >
Placeholder is not customizable in cell while implementing ...
Hi All, We are working on Migrating Project from version5 to version 7.1.9. Existing configuration: In pega version5, we have implementation ...
Read more >
Dynamically Populating Drop Down, Radio Buttons or Multi ...
Dynamically Populating Drop Down, Radio Buttons or Multi-Select Fields ... This is not a Gravity Forms limitation but a consequence of using ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found