Added an example on how to use <select multiple> #2041
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The short Note segment that is currently provided is insufficient to use an
<select multiple={true}>
element.This is especially confusing and frustraring with the sentence "this makes it so that
<input type="text">
,<textarea>
, and<select>
all work very similarly" right before it: In the case of using themultiple
attribute, you do need to change your code a little bit more.The linked anonymous codepen is from me; afaik all codepen example in the documentation are under @gaearon account? What I understand, otherwise someone else can modify the codepen later on; feel free to copy/paste/modify it as you like.
There is also an alternative codepen example which creates a more suitable alert message in
handleSubmit()
, depending on how many options you have selected, but in my opinion it adds unnecessary noice.This issue has also been addressed in #531, #984.