Β© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filamentβ€’2y agoβ€’
3 replies
Joachim Strand

Reset custom table header action modal form

Hi, I have a table header action with a form on a modal that works great. I recently wanted to add a "add and create another" submit button to the modal since I found myself saving and adding again alot.

This is my table header action button placed in the
->headerActions()
->headerActions()
of the table.

I followed the instructions on how to add button, but how can I reset the form? You can see in the action that I tried many options, but none are working.

Tables\Actions\Action::make("add")
    ->label("Add Segment")
    ->icon("heroicon-m-plus")
    ->modalSubmitActionLabel("Save")
    ->extraModalFooterActions(fn (Tables\Actions\Action $action): array => [
        $action->makeModalSubmitAction('createAnother', arguments: ['another' => true])
            ->label("Save and add another"),
    ])
    ->closeModalByClickingAway(false)
    ->form(SegmentForm::getForm())
    ->action(function(array $data, array $arguments, Tables\Actions\Action $action, Forms\Set $set){

        // .. The action

        if($arguments['another'] ?? false){

            // How to reset the form?
            // Have tried these combinations
            $action->resetFormData();

            // Tried with an empty array and with all the fields with "empty" states
            $action->formData([
                "type" => "" // also tried null
            ]);
            $action->fillForm([
                "type" => "" // also tried null
            ]);

            // Also tried $set
            $set("type", null);



            // Stopping the modal from closing
            $action->halt();
        }
    }),
Tables\Actions\Action::make("add")
    ->label("Add Segment")
    ->icon("heroicon-m-plus")
    ->modalSubmitActionLabel("Save")
    ->extraModalFooterActions(fn (Tables\Actions\Action $action): array => [
        $action->makeModalSubmitAction('createAnother', arguments: ['another' => true])
            ->label("Save and add another"),
    ])
    ->closeModalByClickingAway(false)
    ->form(SegmentForm::getForm())
    ->action(function(array $data, array $arguments, Tables\Actions\Action $action, Forms\Set $set){

        // .. The action

        if($arguments['another'] ?? false){

            // How to reset the form?
            // Have tried these combinations
            $action->resetFormData();

            // Tried with an empty array and with all the fields with "empty" states
            $action->formData([
                "type" => "" // also tried null
            ]);
            $action->fillForm([
                "type" => "" // also tried null
            ]);

            // Also tried $set
            $set("type", null);



            // Stopping the modal from closing
            $action->halt();
        }
    }),
`

Anyone experienced this and have solved it? πŸ™‚

Thank you for your help!
Solution
Inject
Form $form
Form $form
and use
$form->fill();
$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

table action modal form refresh?
FilamentFFilament / β“β”Šhelp
2y ago
Modal action or table inside form
FilamentFFilament / β“β”Šhelp
2y ago
Modal Action in Form with Table Modal Body
FilamentFFilament / β“β”Šhelp
9mo ago
table action modal
FilamentFFilament / β“β”Šhelp
3y ago