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
urbycoz7mo ago
It's the form builder. And I do already have $this->form->fill() in the mount method.
LeandroFerreira
LeandroFerreira7mo ago
Any console errors?
urbycoz
urbycoz7mo ago
No, none.
toeknee
toeknee7mo 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.