FilamentF
Filament11mo ago
@maticl

Table action with form - confirmation before submit

Hello,
I am trying to add confirmation (or any kind of modal action) when user clicks submit on a table action with a form.

I have tried with extraModalFooterActions, that contains requiresConfirmation(), which when clicked does show the confirmation (but closes the parent modal, i thought it just displays over it?), but then cancelParentActions() doesn't work, reopening the parent modal again.

Code for extraModalFooterActions:
use Filament\Tables\Actions\Action;
$this->extraModalFooterActions([
  Action::make('confirm')
    ->requiresConfirmation()
    ->action(function ($record) {
      $this->cancelParentActions();
      \Log::debug('confirmed');
    })
]);


Has anyone had similar issues, and if so how did you resolve it?
Solution
inject the action

->action(function (Action $action) {
    $action->cancelParentActions();
})
Was this page helpful?