how can i add requiresConfirmation when creating records

i have trid this
protected function getCreateFormAction(): Action
{
return Action::make('create')
->action('create')
->requiresConfirmation();
}
protected function getCreateFormAction(): Action
{
return Action::make('create')
->action('create')
->requiresConfirmation();
}
but nothing seems to be working someone help me please
Solution:
```php protected function getCreateFormAction(): Action { return parent::getCreateFormAction() ->submit(null)...
Jump to solution
3 Replies
Povilas K
Povilas K•7mo ago
Not sure if that would be any help, but I tried to reproduce and indeed the default create action doesn't trigger confirmation, but any custom callback function instead, would actually work with confirmation.
protected function getCreateFormAction(): Action
{
return Action::make('create')
->requiresConfirmation()
->action(fn () => Notification::make()->title('Created!')->send())
->label(__('filament-panels::resources/pages/create-record.form.actions.create.label'));
}
protected function getCreateFormAction(): Action
{
return Action::make('create')
->requiresConfirmation()
->action(fn () => Notification::make()->title('Created!')->send())
->label(__('filament-panels::resources/pages/create-record.form.actions.create.label'));
}
This worked for me. So, maybe consider building a custom action instead of the default?
Solution
LeandroFerreira
LeandroFerreira•7mo ago
protected function getCreateFormAction(): Action
{
return parent::getCreateFormAction()
->submit(null)
->requiresConfirmation()
->action(fn () => $this->create());
}
protected function getCreateFormAction(): Action
{
return parent::getCreateFormAction()
->submit(null)
->requiresConfirmation()
->action(fn () => $this->create());
}
?
Adnan Yalahow
Adnan YalahowOP•7mo ago
ohh Thank you This solved my problem I have tried something similar and it did not fulfil my requirements, but i appreciate your help🙂
Want results from more Discord servers?
Add your server