#Select same value multiple times

8 messages · Page 1 of 1 (latest)

urban shard
#

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())
,

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())
,

Anyone has an idea to do that?

Thank you!

unkempt carbonBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

worldly quartz
urban shard
#

And be able to select multiple times the same value (my array can have the same string 2,3,4 times)

urban shard
crisp palm
#

maybe togglebutton with multiple value can help you

urban shard
#

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