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),

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
Was this page helpful?