Validate and save before opening modal

I have an edit page with a header action that opens a modal.

I need to save (and validate) the current record before opening modal as it depends on that data being saved as it’s a publish action. The form I need to save is a wizard if that makes any difference.

My header action:

\Filament\Actions\Action::make('Publish!')
    // Validate and save current record, then open modal if it passed, or cancel if validation fails
    ->closeModalByClickingAway(false)
    ->slideOver()
    ->form([
        VacancyPayment::make('Publish details'),
    ])
    ->modalSubmitAction(false)
    ->modalCancelActionLabel('Close')
    ->stickyModalFooter(false),
Was this page helpful?