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 and Edit pages and added a submitAction to my wizard to handle saving the form.

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


When saved the user is redirected to the 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'),
    ];
}
Was this page helpful?