© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•15mo ago•
1 reply
aldec

Conditional tab visibility triggers weird form glitch

Hello! I have a form, where the visibility of a tab is dependent on the selection from another tab. Every time the tab's visibility is true, the content from last tab in the form get's displayed under each tab as well (rather complicated to explain so I added some pictures). Here is the code from the form:

public static function getForm(): array  
{  
    return [  
        Tabs::make('Tabs')  
            ->columnSpanFull()  
            ->tabs([  
                Tabs\Tab::make(label('process.tabs.basic'))  
                    ->schema([  
                        Fieldset::make(label('process.fieldsets.basic'))  
                            ->schema([  
                                Select::make('application_type')  
                                    ->live()  
                                    ->multiple()  
                                    ->required()  
                                    ->options(AufbruchSetting::getOptions("application_type"))  
                                    ->label(label('process.fields.application_type')),  
                                    ]), 
                        ]), 
                Tabs\Tab::make(label('process.tabs.excavation'))  
                    ->visible(function ($record, $get) {  
                        if ($record) {  
                            return $record->excavation !== null;  
                        }  
  
                        $applicationTypes = $get('application_type') ?? [];  
                        return in_array('Aufbruchgenehmigung', $applicationTypes);  
                    })  
                    ->schema([  
                            Fieldset::make(label('process.fieldsets.excavation'))  
                                ->relationship('excavation')  
                                ->schema(Excavation::getForm())  
                    ]),  
                Tabs\Tab::make(label('process.tabs.warranties'))  
                    ->schema([  
                        Repeater::make(label('process.fields.warranties'))  
                    ]),  
            ->contained(false)  
    ];  
}
public static function getForm(): array  
{  
    return [  
        Tabs::make('Tabs')  
            ->columnSpanFull()  
            ->tabs([  
                Tabs\Tab::make(label('process.tabs.basic'))  
                    ->schema([  
                        Fieldset::make(label('process.fieldsets.basic'))  
                            ->schema([  
                                Select::make('application_type')  
                                    ->live()  
                                    ->multiple()  
                                    ->required()  
                                    ->options(AufbruchSetting::getOptions("application_type"))  
                                    ->label(label('process.fields.application_type')),  
                                    ]), 
                        ]), 
                Tabs\Tab::make(label('process.tabs.excavation'))  
                    ->visible(function ($record, $get) {  
                        if ($record) {  
                            return $record->excavation !== null;  
                        }  
  
                        $applicationTypes = $get('application_type') ?? [];  
                        return in_array('Aufbruchgenehmigung', $applicationTypes);  
                    })  
                    ->schema([  
                            Fieldset::make(label('process.fieldsets.excavation'))  
                                ->relationship('excavation')  
                                ->schema(Excavation::getForm())  
                    ]),  
                Tabs\Tab::make(label('process.tabs.warranties'))  
                    ->schema([  
                        Repeater::make(label('process.fields.warranties'))  
                    ]),  
            ->contained(false)  
    ];  
}


I cut most of the other tabs and fields. The last tab (process.tabs.warranties) gets displayed under each other tab if the tab process.tabs.excavation is visible. When I put a different tab as the last one, this one is displayed under each tab. So it's not about the content of the specific last tab but it's position of being the last one.
image.png
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

Conditional visibility of form fields
FilamentFFilament / ❓┊help
15mo ago
Conditional visibility of Repeater extraActions
FilamentFFilament / ❓┊help
2y ago
Assert visibility of every field of Tab in resource form
FilamentFFilament / ❓┊help
3y ago
Conditional form relationships
FilamentFFilament / ❓┊help
3y ago