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.

Bug, 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:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:9

github_iconTop GitHub Comments

5reactions
seanbettscommented, Aug 10, 2020

I think the original poster has eventually solved this problem here: https://codesandbox.io/s/n33qkoy64m

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?

5reactions
ricardobrandaocommented, Apr 6, 2018

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).

Read more comments on GitHub >

github_iconTop 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 >

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