Controlling modals in an action
Hi everyone. Does any one know how to control modals when calling a function like update within an action and have the modal NOT close after it does it's thing.
If the
$this->updateNotes($data)
errors out, I would like the modal and form to stay open so that the user can fix the issues. Right now it closes no matter the results.Solution:Jump to solution
Figured it out.
Just throw a halt exception,
throw new Halt();
in your custom function from the Filament\Support\Exceptions\Halt
namespace.
In my case, the custom function was modified as:...3 Replies
Have you tried to use validation instead?
so validation would work however, in this case, the
$this->updateNotes
method is a call to an api endpoint, which decides if success or not.Solution
Figured it out.
Just throw a halt exception,
throw new Halt();
in your custom function from the Filament\Support\Exceptions\Halt
namespace.
In my case, the custom function was modified as:
This prevents the modal from closing.