© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
10 replies
Koda

Clear Button in custom form

I try to use a "clear" Button in a custom form

protected function getFormActions(): array
    {
        return [
            Action::make('create')
                ->label(__('filament-panels::resources/pages/create-record.form.actions.create.label'))
                ->submit('create'),

            Action::make('clear')
                ->action(function (Set $set) {
                    $set('data.name', '',);
                    $set('name', '');
                    $this->form->fill();
                })
        ];
    }
protected function getFormActions(): array
    {
        return [
            Action::make('create')
                ->label(__('filament-panels::resources/pages/create-record.form.actions.create.label'))
                ->submit('create'),

            Action::make('clear')
                ->action(function (Set $set) {
                    $set('data.name', '',);
                    $set('name', '');
                    $this->form->fill();
                })
        ];
    }

The create Button works, but the clear buton does not.
Solution
try
Action::make('clear')
    ->action('clear')
Action::make('clear')
    ->action('clear')


public function clear(): void
{
    $this->form->fill();
}
public function clear(): void
{
    $this->form->fill();
}
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

Add custom button in Relation manager form
FilamentFFilament / ❓┊help
16mo ago
Add custom button in Component with form.
FilamentFFilament / ❓┊help
3y ago
Custom button for a form
FilamentFFilament / ❓┊help
2y ago
Adding custom form action button
FilamentFFilament / ❓┊help
3y ago