© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
17 replies
Ric Le Poidevin

Save form before running action

Is it possible to validate and save a form before an action it run? I want to ensure all the data is correct and stored but running a publish action.
Solution
For anyone finding this here is the solution that worked for me

I removed the save buttons from the
Create
Create
and
Edit
Edit
pages and added a
submitAction
submitAction
to my wizard to handle saving the form.

Forms\Components\Wizard::make([...])
  ->submitAction(\Filament\Actions\Action::make('create')
  ->label('Save')
  ->submit('create'))->columnSpanFull(),
Forms\Components\Wizard::make([...])
  ->submitAction(\Filament\Actions\Action::make('create')
  ->label('Save')
  ->submit('create'))->columnSpanFull(),


When saved the user is redirected to the
Edit
Edit
page for the resource. I then added a header action as below.
protected function getHeaderActions(): array
{
    return [
        Actions\DeleteAction::make(),
        $this->getSaveFormAction()
            ->submit(null)
            ->action('save'),
        \Filament\Actions\Action::make('Publish')
            ->closeModalByClickingAway(false)
            ->slideOver()
            ->icon('heroicon-o-check-badge')
            ->form([
                BraintreePayment::make('payment')
                    ->viewData([
                        ...
                    ])
            ])
            ->disabled(function (Vacancy|null $record) {
                return $record?->is_published;
            })
            ->modalSubmitAction(false)
            ->modalCancelActionLabel('Close'),
    ];
}
protected function getHeaderActions(): array
{
    return [
        Actions\DeleteAction::make(),
        $this->getSaveFormAction()
            ->submit(null)
            ->action('save'),
        \Filament\Actions\Action::make('Publish')
            ->closeModalByClickingAway(false)
            ->slideOver()
            ->icon('heroicon-o-check-badge')
            ->form([
                BraintreePayment::make('payment')
                    ->viewData([
                        ...
                    ])
            ])
            ->disabled(function (Vacancy|null $record) {
                return $record?->is_published;
            })
            ->modalSubmitAction(false)
            ->modalCancelActionLabel('Close'),
    ];
}
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Save form before calling a header action
FilamentFFilament / ❓┊help
3y ago
Running JS before save
FilamentFFilament / ❓┊help
2mo ago
Can't save form action
FilamentFFilament / ❓┊help
2y ago
Save form from a header action
FilamentFFilament / ❓┊help
16mo ago