How can I set a default value for a Select field in a Filament form when editing a record?

``` Why is the default value not being set for a multi-select (Select::make()->multiple()) field in Filament, and how can I fix it? SelectColumn::make('status') ->options([ 'draft' => 'Draft', 'reviewing' => 'Reviewing', 'published' => 'Published', ])->default('draft')
2 Replies
awcodes
awcodes3d ago
In the editing context it should already have a value. That should have been handled on creation of the record. But you can use ->afterStateHydrated() to set a default. Or the formFill() on the LW component.
Dennis Koch
Dennis Koch3d ago
Use mutateDataBeforeFill() for EditPages

Did you find this page helpful?