Is it possible to set default selected value?
Is it possible to set default selected option in select field without using db table’s default()? This is basically for adding selected attribute into the <option> html tag. In addition to this, any way to achieve the same for select field with relationship?
Solution:Jump to solution
```php
Select::make('select')
->options([
1 => 'Option 1',
2 => 'Option 2',...
8 Replies
Solution
?
That works. Thanks!!
Leandro i try this
and doesn't works. How can i do?
I use Form Builder onlye
Is there a mount method with
$this->form->fill()
?
Did you follow these steps?
https://filamentphp.com/docs/3.x/forms/adding-a-form-to-a-livewire-component/#adding-the-formYes, there is. But i need to fill select with values based on three booleans fields, and i don't know how
Share the code you are trying to do please
i can do using this. May be it's not the best solution but it works.
On mount this code
on save method
and field structure
select multiple should be
->default([2])