© 2026 Hedgehog Software, LLC

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

Hidden field works only while create and not edit

Hi, i have 2 dependant fields
Section::make('Customer type and company')
                            ->schema([
                                Radio::make('customer_type')
                                    ->label('Customer type')
                                    ->options(CustomerType::class)
                                    ->default(CustomerType::PRIVATE)
                                    ->inline()
                                    ->live()
                                    ->columnSpan(1),
                                Select::make('company_id')
                                    ->visible(fn ( Get $get) => $get('customer_type') === CustomerType::BUSINESS)
                                    ->relationship(name: 'companies', titleAttribute: 'name')
                                    ->preload()
                                    ->multiple()
                                    ->native(false)
                                    ->searchable()
                                    ->columnSpan(2),
                            ])->columns(2),
Section::make('Customer type and company')
                            ->schema([
                                Radio::make('customer_type')
                                    ->label('Customer type')
                                    ->options(CustomerType::class)
                                    ->default(CustomerType::PRIVATE)
                                    ->inline()
                                    ->live()
                                    ->columnSpan(1),
                                Select::make('company_id')
                                    ->visible(fn ( Get $get) => $get('customer_type') === CustomerType::BUSINESS)
                                    ->relationship(name: 'companies', titleAttribute: 'name')
                                    ->preload()
                                    ->multiple()
                                    ->native(false)
                                    ->searchable()
                                    ->columnSpan(2),
                            ])->columns(2),

when i select the BUSINESS option, a select is visible
but it works only when i create a new customer
in edit mode, doesn't works.
Solution
otherwise you would have to check against the actual value
$get('customer_type') === CustomerType::BUSINESS->value
$get('customer_type') === CustomerType::BUSINESS->value
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

Edit Page not showing Hidden Field
FilamentFFilament / ❓┊help
3y ago
I broke media library, only works on edit and not on create.
FilamentFFilament / ❓┊help
3y ago
Create Page View And Edit Only?
FilamentFFilament / ❓┊help
2y ago
How to add a form field only in CREATE and NOT in EDIT?
FilamentFFilament / ❓┊help
3y ago