->requiresConfirmation() on a button on the blade
Guys, is there any way to add the ->requiresConfirmation() to a button in blade?
Solution:Jump to solution
Thanks, I managed to do this:
```
public function deliverAction(): Action
{...
7 Replies
You can't use that method – since it's part of the field API – but you could check the source code for the same code that opens a modal and runs code after.
I've done it in one project by calling an existing action
Maybe explain more about your "button in Blade". Why don't you use a Filament Action?
If it can help, this works fine when using a custom Livewire component in a resource form:
You need to have an existing action in the same page:
My button looks like this:
It already calls a function on the custom page, this function changes the state of some data. But I needed it to issue requiresConfirmation when the button is pressed so there are no errors. The button has to be customized like this on the blade.
you could move your logic to an existing action if you are in a resource context
OR
use livewire native confirmation:
https://livewire.laravel.com/docs/wire-confirm
Laravel
wire:confirm | Laravel
A full-stack framework for Laravel that takes the pain out of building dynamic UIs.
Solution
Thanks, I managed to do this: