F
Filament15mo ago
JohnnyC

Action : Modal don't show

I use Filament Panel. When I click on Action button, livewire update request is runing but modal doesn't show. This my Widget :
<?php

namespace App\Filament\Widgets\SessionPlanning;

use Filament\Actions;
use Filament\Forms;
use Filament\Widgets\Widget;

class SessionOverview extends Widget implements Forms\Contracts\HasForms, Actions\Contracts\HasActions
{
use Forms\Concerns\InteractsWithForms, Actions\Concerns\InteractsWithActions;

protected static string $view = 'filament.widgets.session-planning.session-overview';

public function createWorkout(): Actions\Action
{
return Actions\Action::make('createWorkout')
->form([
Forms\Components\Select::make('workout')
->options([
'bench_press' => 'Bench Press',
])
->label('Workout')
->required(),
]);
}
}
<?php

namespace App\Filament\Widgets\SessionPlanning;

use Filament\Actions;
use Filament\Forms;
use Filament\Widgets\Widget;

class SessionOverview extends Widget implements Forms\Contracts\HasForms, Actions\Contracts\HasActions
{
use Forms\Concerns\InteractsWithForms, Actions\Concerns\InteractsWithActions;

protected static string $view = 'filament.widgets.session-planning.session-overview';

public function createWorkout(): Actions\Action
{
return Actions\Action::make('createWorkout')
->form([
Forms\Components\Select::make('workout')
->options([
'bench_press' => 'Bench Press',
])
->label('Workout')
->required(),
]);
}
}
And my widget view :
<x-filament-widgets::widget>
{{ $this->createWorkout }}
</x-filament-digets::widget>
<x-filament-widgets::widget>
{{ $this->createWorkout }}
</x-filament-digets::widget>
And i have no error. Have you an idea to resolve it ? Thank you
Solution:
Name your method ‘createWorkoutAction’
Jump to solution
4 Replies
Patrick Boivin
Patrick Boivin15mo ago
I think you need an ->action(function () { ... }) as well on the Action
JohnnyC
JohnnyCOP15mo ago
I tried and same result
Solution
awcodes
awcodes15mo ago
Name your method ‘createWorkoutAction’
JohnnyC
JohnnyCOP15mo ago
Oh nice, thank you so much!

Did you find this page helpful?