Computed state in form fields.
Hi,
I'd like to have the state totally computed in some form fields.
The state would be calculated with a function, and refreshed at each render.
Like a
Basically doing the same as we can with
On the table, we can use
Setting the state directly using
Is it something easily possible?
Could we add a
Thanks!
I'd like to have the state totally computed in some form fields.
The state would be calculated with a function, and refreshed at each render.
Like a
Placeholder, but with real fields.Basically doing the same as we can with
disabled, or readOnly but with the state.On the table, we can use
getStateUsing: Tables\Columns\TextColumn::make('foo')->getStateUsing(fn ($record) => Foo::compute($record))Setting the state directly using
state(fn() => ...) on a TextInput throws an error: Typed property Filament\Forms\Components\Component::$container must not be accessed before initialization (in the getLivewire function).Is it something easily possible?
Could we add a
getStateUsing to the input as well? (I can open a PR)Thanks!