© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
1 reply
Igor

Conditional Select options don`t work if disabled field

Hi guys, seems a bug to me.
I'm trying enable and add options dynamically in a select after another select changes, but if I add the disabled option in the second select, it not add any option, if I remove it, works like a charm

                    Select::make('cliente_id')
                        ->relationship('cliente', 'nome')
                        ->searchable()
                        ->live(onBlur: true)
                        ->required(),
                    Select::make('veiculo_cliente')
                        ->required()
                        ->disabled(fn (Get $get): bool => ! $get('cliente_id'))
                        ->native(false)
                        ->allowHtml()
                        ->options(function (Get $get) {
                            $id = $get('cliente_id');
                            if (!$id) {
                                return [];
                            }
                            return Cliente::find($id)->veiculos->map( function (array $veiculo) {
                               return view('veiculoSelectItem',$veiculo)->render();
                            })->toArray();
                        })
                    Select::make('cliente_id')
                        ->relationship('cliente', 'nome')
                        ->searchable()
                        ->live(onBlur: true)
                        ->required(),
                    Select::make('veiculo_cliente')
                        ->required()
                        ->disabled(fn (Get $get): bool => ! $get('cliente_id'))
                        ->native(false)
                        ->allowHtml()
                        ->options(function (Get $get) {
                            $id = $get('cliente_id');
                            if (!$id) {
                                return [];
                            }
                            return Cliente::find($id)->veiculos->map( function (array $veiculo) {
                               return view('veiculoSelectItem',$veiculo)->render();
                            })->toArray();
                        })
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

Dynamic select options don't work with native Select
FilamentFFilament / ❓┊help
2y ago
Conditional Select Field
FilamentFFilament / ❓┊help
3y ago
Testing select field options
FilamentFFilament / ❓┊help
3y ago
Select options don't update when using "javascript" select
FilamentFFilament / ❓┊help
3y ago