Triggering Filament Action from Livewire Form Submission

I am facing an issue with triggering a Filament action from a Livewire form submission. I have created a Filament page that contains a custom Livewire form. The desired behavior is that when I submit the form, a Filament action should be triggered, and a confirmation modal should pop up. However, I am currently experiencing a problem where nothing happens when I try to submit the form.
No description
5 Replies
ianclemence
ianclemenceOP15mo ago
This is the view where the form is located
No description
Patrick Boivin
Patrick Boivin15mo ago
I don't think you can return an Action object from your submit method. Maybe you could use an action in your form directly, instead of the submit button The action could use ->requiresConfirmation() to show a modal, then process the form submission
ianclemence
ianclemenceOP15mo ago
Thank you. I have tried it and now it works. Quick question: is it possible to use ->successRedirectUrl() and ->succesNotification() in the Action:: ? Coz I have tried but nothing is happening even though the data is saved
Patrick Boivin
Patrick Boivin15mo ago
I'm not sure, but I think you can return a redirect from an action, like this:
->action(function () {
// ...

return redirect(...);
})
->action(function () {
// ...

return redirect(...);
})
You can also trigger a custom notification from the action.
ianclemence
ianclemenceOP15mo ago
It worked. Thank you!
Want results from more Discord servers?
Add your server