Actions Modal not displayed on Custom Page

I am trying to use Actions on a Custom Page, but the modal does not open. When I use the identical action on a resource page, it operates as expected. '''php class ImportCentre extends Page { protected static ?string $navigationIcon = 'fas-folder-open'; protected static ?string $navigationGroup = 'System Settings'; protected static string $view = 'filament.pages.import-centre'; public function importHolidayRequestsAction() { return ImportAction::make() ->importer(HolidayRequestImporter::class); } public function importOvertimeDataAction() { return Action::make('overtime_data') ->form([ Select::make('user') ->placeholder('Select a user') ->options(fn () => User::all()->pluck('name', 'id')->toArray()) ->required(), Select::make('year') ->placeholder('Select a year') ->options(function () { $years = []; for ($i = 2020; $i <= now()->year; $i++) { $years[$i] = $i; } return $years; }) ->required(), FileUpload::make('overtime_log') ->label('Upload Overtime Log') ->acceptedFileTypes(['text/csv']) ->panelLayout('compact') ->required() ->disk('s3') ->visibility('private') ->moveFiles() ->directory('overtime_logs') ])->action(fn(array $data) => (new ImportOvertimeDataAction())->handle($data)); } } ''' '''html <x-filament-panels::page> <div class="flex"> {{$this->importOvertimeDataAction}} </div> </x-filament-panels::page> '''
Any ideas?
Solution:
It doesn't mention it in the documentation, and I had the same issue recently, but the Action name has to have a level of similarity to the method name for your action. Try this: ```php...
Jump to solution
5 Replies
Solution
Andrew Wallo
Andrew Walloβ€’6mo ago
It doesn't mention it in the documentation, and I had the same issue recently, but the Action name has to have a level of similarity to the method name for your action. Try this:
public function importOvertimeDataAction()
{
return Action::make('importOvertimeData')
->form([
...
]).
}
public function importOvertimeDataAction()
{
return Action::make('importOvertimeData')
->form([
...
]).
}
Andrew Wallo
Andrew Walloβ€’6mo ago
If that doesnt work then it is something else. He is using a Filament action. The blade component is for a custom modal implementation.
TomEasterbrook98
TomEasterbrook98β€’6mo ago
Thank you so much πŸ™‚