Dekus
How to add action who requires confirmation in modal extra actions
Hi everyone,
I have a modal like this
public function editActivityForm(Form $form): Form
{
return $form
->schema([
Actions::make([
Action::make('editTask')
->form([
TextInput::make('name')
->required(),
Textarea::make('description'),
DatePicker::make('start_date')
->required(),
DatePicker::make('end_date')
->required()
])
->fillForm(fn () =>
$this->activities[array_search(
$this->editActivityId,
array_column($this->activities, 'id')
)])
->modalCancelAction(false)
->extraModalFooterActions(fn () => [
Action::make('Delete task')
->button()
->color('danger')
->requiresConfirmation()
->action(
fn () => $this->deleteTask()
)
])
->action(fn (array $data) => $this->editTask($data))
])
]);
}
but whenever I try to use 'extraModalFooterActions' I get the following error:
https://flareapp.io/share/B5ZZGOp52 replies
Open action modals inside a modal
Hi everyone,
I have a form to edit a resource, following there will be the code. I render this form inside a filament blade modal that I handle using Alpine.js.
I have two questions, can I put a submit button as a action? So using the builder instead of writing it into the template.
Second question, can I use requiresConfirmation() inside the modal? Because it doesn't work. To be fair I tried it also outside the modal and It doesn't work. No js error, it just goes straight with the request.
public function editTaskForm(Form $form): Form
{
return $form
->schema([
TextInput::make('name')
->required(),
Textarea::make('description'),
DatePicker::make('start_date')
->required(),
DatePicker::make('end_date')
->required(),
Actions::make([
Action::make('Delete task')
->link()
->color('danger')
->action('deleteTask')
->requiresConfirmation()
])
])->statePath('editTaskData');
}
<x-filament::modal id="edit-task">
<x-slot name="heading">
Modifica il task
</x-slot>
<x-slot name="description">
Modal description
</x-slot>
<form wire:submit="editTask">
{{ $this->editTaskForm }}
<x-filament::button type="submit">
Submit
</x-filament::button>
<x-filament-actions::modals />
</form>
</x-filament::modal>
4 replies