rapolasgruzdys
Unable to set a default value for \Filament\Forms\Components\Select
I want to select predefined options in my Select component. Looking at the docs, if a Select component has
options()
set, and a default()
state set - it should automatically preselect an option. Unfortunately, the example in the docs does not do anything - the default('draft')
method call doesn't do anything in this piece of code:
I've tried setting default values via the state()
method, and a bunch of others. The only working method that actually did anything was the relationship()
one. But it queries eloquent for options and selected values. However, mine are static.
Am I missing something obvious or doesn't this basic Select component support preselected values? Even basic HTML can do that 🤔
I was stuck with this in v2 and was hoping for a solution in v3, but nothing has changed. So my question is valid for both.12 replies