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.

Multiselect not selecting a value

See original GitHub issue

I use the following code to create a select which works fine.

                 <Select
                    name="form-field-name"
                    
                    value={this.state.selectedOption.value}
                    onChange={this.handleChange}
                    options={[
                      { value: 'one', label: 'One' },
                      { value: 'two', label: 'Two' },
                    ]}
                  />

But when I add a mulit={true} to this, it doesn’t work. Even when I select a value it shows undefined. Am I doing something wrong?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

16reactions
ktranelcommented, Jul 31, 2018

for any poor soul that follows the docs on the official site that says ‘isMulti’ change this to ‘multi’.

8reactions
SoorajChandrancommented, Dec 14, 2017

I solved this using below code:

            <Select
              name="form-field-name"
              value={this.state && this.state.techFilter}
              multi
              placeholder="Filter by language/framework"
              onChange={(...args) => this.handleChange(...args)}
              options={[
                { value: "reactjs", label: "ReactJs" },
                { value: "css", label: "CSS" },
                { value: "es6", label: "ES6" },
                { value: "nodejs", label: "Node" }
              ]}
            />
 handleChange = selectedOptions => {
    this.setState({ techFilter: selectedOptions });
  };
Read more comments on GitHub >

github_iconTop Results From Across the Web

The value show in the multi-select function not properly
I have 2 problems in the multi-select function: i)The first problem, I set the value if clicked the Show Volvo and Opel and...
Read more >
Multiselect not working with preselected values
Hi I have this code: <pre><div class=md-form> <i class=fa fa-cutlery prefix></i> <select class=mdb-select colorful-select ...
Read more >
Get selected values in a multi-select drop-down with JavaScript
This post will discuss how to get the selected values in a multi-select dropdown in plain JavaScript. We can select the multiple options...
Read more >
Vue-Multiselect | Vue Select Library
Due to the one-way data-flow enforced by Vuex you should not be using v-model for manipulating the currently selected value. Because Vue-Multiselect always...
Read more >
JavaScript MultiSelect API control - Syncfusion
By default, the multiselect component fires the change event while focus out the component. If you want to fires the change event on...
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