F
Filament13mo ago
urbycoz

How to set a default on a searchable Select

When I make my Select searchable() it prevents the default value getting set. Is there a way around this? Select::make('status') ->options([ 'draft' => 'Draft', 'reviewing' => 'Reviewing', 'published' => 'Published', ]) ->searchable() //When I remove this the default gets set ok ->selectablePlaceholder(false) ->default('draft');
5 Replies
urbycoz
urbycozOP13mo ago
It's the form builder. And I do already have $this->form->fill() in the mount method.
LeandroFerreira
LeandroFerreira13mo ago
Any console errors?
urbycoz
urbycozOP13mo ago
No, none.
toeknee
toeknee13mo ago
Select::make('status')
->options([
'draft' => 'Draft',
'reviewing' => 'Reviewing',
'published' => 'Published',
])
->default('draft')
->searchable() //When I remove this the default gets set ok
->selectablePlaceholder(false);
Select::make('status')
->options([
'draft' => 'Draft',
'reviewing' => 'Reviewing',
'published' => 'Published',
])
->default('draft')
->searchable() //When I remove this the default gets set ok
->selectablePlaceholder(false);
Does that change anything? I would also try ->default(['draft']) on the basis searchable might be searching an array, possibly.
Want results from more Discord servers?
Add your server