© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•16mo ago•
9 replies
ChesterS

Save form from a header action

Is it possible to save a form from a header action (or before a header action?

Let's say I have the following header actions in an edit form

protected function getHeaderActions(): array {
  return [
    Action::make('print'),
    Action::make('duplicate'),
  ]
}
protected function getHeaderActions(): array {
  return [
    Action::make('print'),
    Action::make('duplicate'),
  ]
}

Is there a way to submit the form before any of those actions is executed? Or somehow submit it inside the button action itself?

I tried this but it doesn't work
Action::make('test')
    ->requiresConfirmation()
    ->action(fn (array $data) => dd($data)), // Data is empty
Action::make('test')
    ->requiresConfirmation()
    ->action(fn (array $data) => dd($data)), // Data is empty


Or if there's a way to detect if a form has been changed and then ask for a confirmation to save before proceeding? Any ideas are welcome.
Solution
Oh okay, you can do something like this:

Action::make('doSomething')
  ->action(function($record, $data) {
    $this->save();
    // ... do something else in the action
  )
Action::make('doSomething')
  ->action(function($record, $data) {
    $this->save();
    // ... do something else in the action
  )
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

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Save form before calling a header action
FilamentFFilament / ❓┊help
3y ago
Submitting form from Section header action
FilamentFFilament / ❓┊help
2y ago
How to trigger a form save from another action?
FilamentFFilament / ❓┊help
3y ago
Add header Form action buttons
FilamentFFilament / ❓┊help
13mo ago