Skip to content

Help! multi select with final form #2605

Answered by lbd1607
Duckinm asked this question in Q&A
Discussion options

You must be logged in to vote

Hi Duckinm,

I've tried implementing the useField() hook to accomplish multi-select, but had a lot of trouble getting it to work. Here is how I have implemented multi-select in my Blitz apps instead:

Multi-select

Here's an example of multi-select implementation in Blitz. In this example, I'm creating a list that allows me to select multiple Star Wars characters.

1. Set up the data model

Put the name of your multi-select field in your data model as a scalar list:

model List {
  id         Int      @id @default(autoincrement())
  listName   String   @unique
  characters String[]
}

2. Configure mutations

Add the attribute to your create and edit mutations. Here's what it looks like in the cre…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Duckinm
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