Skip to content

How to implement a multiple select? #103

Answered by pablo-abc
ricardo-valero asked this question in Q&A
Discussion options

You must be logged in to vote

Your example should work without any changes as of @felte/[email protected]. A slight difference from how Svelte handles it is that we take the values as the DOM would have theme in the case of <select> elements. That means that the value you'll receive will always be a string or an array of strings in the case of <select multiple>.

Nothing prevents you from assigning a stringified JSON as value, you'd need to parse it on submission or transform it using a transform function.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by pablo-abc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants