Function to submit form

I would like to submit the form after the user updates a select field. I tried it with live() but after updating the select field and reloading the page (without pressing save button) it is not being updated in the database
Solution:
Are you using the panel builder? ```php ->afterStateUpdated(function (\Livewire\Component $livewire, string $operation) { if ($operation == 'edit') {...
Jump to solution
3 Replies
_𝕰𝖋x
_𝕰𝖋xOPβ€’9mo ago
I tried
php ->afterStateUpdated(function (Model $record, array $data) { $record->update($data); return $record; })
php ->afterStateUpdated(function (Model $record, array $data) { $record->update($data); return $record; })
but I get following error: An attempt was made to evaluate a closure for [Filament\Forms\Components\Select], but [$data] was unresolvable.
toeknee
toekneeβ€’9mo ago
$data doesn't exist, you would need $get or $state state being the field
Solution
LeandroFerreira
LeandroFerreiraβ€’9mo ago
Are you using the panel builder?
->afterStateUpdated(function (\Livewire\Component $livewire, string $operation) {
if ($operation == 'edit') {
$livewire->save();
}
})
->afterStateUpdated(function (\Livewire\Component $livewire, string $operation) {
if ($operation == 'edit') {
$livewire->save();
}
})
Want results from more Discord servers?
Add your server