Select same value multiple times

Hello guys, I'm new with Filament, and i'm trying to make a field named "retreats". This is an array of strings attribute, which can contain values from a predefined list. I'd like to have a kind of "TagsInput" field, with suggestions. But as soon as I select a value, I cannot select it again.
Forms\Components\TagsInput::make('retreat')
->suggestions(CardEnergy::all()->mapWithKeys(fn ($energy) => [$energy->id => Str::ucfirst($energy->value)])->toArray())
,
Forms\Components\TagsInput::make('retreat')
->suggestions(CardEnergy::all()->mapWithKeys(fn ($energy) => [$energy->id => Str::ucfirst($energy->value)])->toArray())
,
Because I don't want insert some custom values, I also tried with a Select, but same result: I can't select the same value:
Forms\Components\Select::make('retreat')
->multiple()
->options(CardEnergy::all()->mapWithKeys(fn ($energy) => [$energy->id => Str::ucfirst($energy->value)])->toArray())
,
Forms\Components\Select::make('retreat')
->multiple()
->options(CardEnergy::all()->mapWithKeys(fn ($energy) => [$energy->id => Str::ucfirst($energy->value)])->toArray())
,
Anyone has an idea to do that? Thank you!
6 Replies
Blackpig
Blackpig7d ago
If i understand correctly you want to be able to select multiple options from a pre-defined list of options? That's probably best suited to a checkbox list https://filamentphp.com/docs/3.x/forms/fields/checkbox-list
DimZeta
DimZetaOP7d ago
And be able to select multiple times the same value (my array can have the same string 2,3,4 times)
DimZeta
DimZetaOP6d ago
This is the behavior I want to reproduce
Khairul Imran
Khairul Imran6d ago
maybe togglebutton with multiple value can help you
DimZeta
DimZetaOP6d ago
I still can't select the same value multiple times with a toggle button I finally did a lot of spaceRepeater with simple(), it does the job but this is not very nice to use and takes
DimZeta
DimZetaOP6d ago
I finally did a Repeater with simple(), it does the job but this is not very nice to use and takes a lot of space
No description
Want results from more Discord servers?
Add your server