© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
2 replies
tjodalv

Validate form from custom Action button - maybe bug

I've added custom action button on resource edit page and I want to validate form before proceeding with action. There is strange bug or weird behaviour. This is my action button:

class EditTask extends EditRecord
{
    protected static string $resource = TaskResource::class;

    protected function getHeaderActions(): array
    {
        return [
            Actions\Action::make('Complete task')
                ->action(function () {
                    // I've found somewhere on discord that this validates form.
                    // It does but only the first time when this action is executed,
                    // if you click on the button again then empty modal is opened
                    // with two buttons Submit and Cancel ?!?
                    $this->form->getState();
                    
                    // after validation form should be saved
                    $this->save();

                    // the rest of action code should be here
                }),
            Actions\ViewAction::make(),
            Actions\DeleteAction::make(),
        ];
    }
}
class EditTask extends EditRecord
{
    protected static string $resource = TaskResource::class;

    protected function getHeaderActions(): array
    {
        return [
            Actions\Action::make('Complete task')
                ->action(function () {
                    // I've found somewhere on discord that this validates form.
                    // It does but only the first time when this action is executed,
                    // if you click on the button again then empty modal is opened
                    // with two buttons Submit and Cancel ?!?
                    $this->form->getState();
                    
                    // after validation form should be saved
                    $this->save();

                    // the rest of action code should be here
                }),
            Actions\ViewAction::make(),
            Actions\DeleteAction::make(),
        ];
    }
}
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Adding custom form action button
FilamentFFilament / ❓┊help
3y ago
Action form, validate data from API
FilamentFFilament / ❓┊help
11mo ago
form action button alignment
FilamentFFilament / ❓┊help
8mo ago
form button with action
FilamentFFilament / ❓┊help
2y ago