F
Filamentβ€’15mo ago
Sanchit Patil

CreateAction not doing anything after click

Hello, I am trying to add CreateAction to a custom page but when I click on the button it doesn't do anything, not even producing any js error.
public function createNewTrainingEvent(): Action{
return CreateAction::make()
->label('New Training Event')
->model(TrainingEvent::class)
->form(TrainingEventResource::getFormSchema());
}
public function createNewTrainingEvent(): Action{
return CreateAction::make()
->label('New Training Event')
->model(TrainingEvent::class)
->form(TrainingEventResource::getFormSchema());
}
View File:
<x-filament-panels::page>
<div id='calendar-container'>
<div class="grid md:grid-cols-12 sm:grid-cols-1">
<div class="md:col-span-4 col-span-12">
{{ $this->createNewTrainingEvent }}
<x-filament-actions::modals />
</div>
<div class="md:col-span-8 col-span-12 tdta_back_calendar" wire:ignore>
<div id='calendar'></div>
</div>
</div>
</div>
</x-filament-panels::page>

@push('scripts')
<script src='https://cdn.jsdelivr.net/npm/[email protected]/index.global.min.js'></script>
<script type="module">
// full calendar scripts here
</script>
@endpush
<x-filament-panels::page>
<div id='calendar-container'>
<div class="grid md:grid-cols-12 sm:grid-cols-1">
<div class="md:col-span-4 col-span-12">
{{ $this->createNewTrainingEvent }}
<x-filament-actions::modals />
</div>
<div class="md:col-span-8 col-span-12 tdta_back_calendar" wire:ignore>
<div id='calendar'></div>
</div>
</div>
</div>
</x-filament-panels::page>

@push('scripts')
<script src='https://cdn.jsdelivr.net/npm/[email protected]/index.global.min.js'></script>
<script type="module">
// full calendar scripts here
</script>
@endpush
the same works when I call this action from header actions.
protected function getHeaderActions(): array
{
return [
CreateAThe ction::make()
->label('New Training Event')
->model(TrainingEvent::class)
->form(TrainingEventResource::getFormSchema())
];
}
protected function getHeaderActions(): array
{
return [
CreateAThe ction::make()
->label('New Training Event')
->model(TrainingEvent::class)
->form(TrainingEventResource::getFormSchema())
];
}
could anyone please help me with this? Am I doing anything wrong here? Thank You. πŸ™‚
4 Replies
Patrick Boivin
Patrick Boivinβ€’15mo ago
Have you tried with a regular Action? (not CreateAction)
Sanchit Patil
Sanchit PatilOPβ€’15mo ago
yes, I have tried with just Action with a unique name, but it still has the same issue.
Dennis Koch
Dennis Kochβ€’15mo ago
The action name must be the same as the method name. In your case it should be CreateAction::make('createNewTrainingEvent')
Sanchit Patil
Sanchit PatilOPβ€’15mo ago
perfecto.. oh god, thank you very much to both of you.
Want results from more Discord servers?
Add your server