Multiple select
See original GitHub issueBug, Feature, or Question?
Question
Current Behavior
I’m trying to create a multiple select field, but it seems empty out the array when I click on a item.
Desired Behavior
Update the array when I change selection.
Suggested Solutions
Maybe some specific behaviour for the multiple
attribute?
Additional Information
- Formik Version: 0.11.11
- React Version: 16.2
- TypeScript Version: 2.8.1
- CodeSandbox Link: https://codesandbox.io/s/mzpv1o7pm9
- OS: Linux
- Node Version: 8.11.1
- Package Manager and Version: NPM 5.8.0
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:9
Top Results From Across the Web
Multiple Select · Multiple Select is a jQuery plugin to select ...
Multiple Select has been designed to reduce development time and to require no specific knowledge from developers. It is both featherweight and feature-rich ......
Read more >HTML select multiple Attribute - W3Schools
The multiple attribute is a boolean attribute. When present, it specifies that multiple options can be selected at once. Selecting multiple options vary...
Read more >Select Multiple select Example - Mobiscroll
Use it on mobile and desktop for listing different options with multiple select. It can be tied to an input, native select or...
Read more >Basic usage | Select2 - 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 >Bootstrap Multiselect - free examples, templates & tutorial
Unlike a standard Select, multiselect allows the user to select multiple options at once. Note: To learn more about Select component and see...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This seems to work well but it based on v0.11.11 of Formik. Has anyone got a working example of implementing multiple select on an up-to-date version of Formik?
You need to handle the changes to the field yourself. I’ve updated your code sample here. Take a closer look at line 31 (i.e. the
onChange
callback).