How can I stop my Select options getting reset when visibility toggled
I've got a form with a toggle and a select. When the toggle is turned off the select should be hidden. But when I toggle back on the select has its options removed.
How can I stop this happening?
Section::make('Contact Address')
->schema([
Toggle::make('useSameAddress')
->label('Same as residential address')
->live() ->reactive(), Grid::make(1) ... ->schema([
Select::make('contactcountry') ->extraAttributes(['class' => 'contact_country']) ->placeholder('Select option') ->searchable() ->options($this->countries) ->label('Country'), ]) ->hidden( fn (Get $get): bool => $get('useSameAddress') === true ) ]),
->live() ->reactive(), Grid::make(1) ... ->schema([
Select::make('contactcountry') ->extraAttributes(['class' => 'contact_country']) ->placeholder('Select option') ->searchable() ->options($this->countries) ->label('Country'), ]) ->hidden( fn (Get $get): bool => $get('useSameAddress') === true ) ]),
0 Replies