© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•15mo ago•
4 replies
pinoooh

Post hidden fields to reset data

Hi there,

I have a resource-form with multiple steps, and on top of each step is a toggle to "enable" some fields visually. If the toggle is enabled, the form-fields are displayed which contains all sorts of input: text, (multi)-select with relations, repeaters, etc. All of this works perfectly. Psuedo-form to give you an idea:

Step::make('step 1'))->schema([
    Toggle::make('toggle_1')
        ->default(false)
        ->live(),
        
    Group::make()
        ->visible(if_enabled('toggle_1'))
        ->schema([
            TextInput->make('name');
        ]);
]);

Step::make('step 2'))->schema([
    Toggle::make('toggle_2')
        ->default(false)
        ->live(),
        
    Group::make()
        ->visible(if_enabled('toggle_2'))
        ->schema([
            Select->make('relation.name')
                ->multiple();
        ]);
]);
Step::make('step 1'))->schema([
    Toggle::make('toggle_1')
        ->default(false)
        ->live(),
        
    Group::make()
        ->visible(if_enabled('toggle_1'))
        ->schema([
            TextInput->make('name');
        ]);
]);

Step::make('step 2'))->schema([
    Toggle::make('toggle_2')
        ->default(false)
        ->live(),
        
    Group::make()
        ->visible(if_enabled('toggle_2'))
        ->schema([
            Select->make('relation.name')
                ->multiple();
        ]);
]);


As said: all works perfectly! Now I want to "reset" all the input on a specific step if the toggle is disabled. In other words: I want to set the fields to null, delete relations etc if the toggle is off.
I could do this "manually" using
mutateFormDataBeforeSave
mutateFormDataBeforeSave
for example (lots of if issets etc), but I would rather have the logic on the form itself to keep the logic grouped.

Is this even possible? I tried making an extension of a group, which creates hidden fields but this does not work well. Is there another way to do this?

Thanks in advance!
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

Hidden fields
FilamentFFilament / ❓┊help
3y ago
Unable to save hidden() fields to database !!
FilamentFFilament / ❓┊help
3y ago
Include hidden fields
FilamentFFilament / ❓┊help
12mo ago
Empty hidden fields
FilamentFFilament / ❓┊help
2y ago