© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
9 replies
Augus

Select field issues with combination of Live + Disabled.

So i have been playing around whole night to get this to work but im simply not able to.

What i want to do is pretty simple though;
1. I want to have the "Location" (UBN) select field to be disabled.
2. User selects a "Contact" (Relatie) in the first select field.
3. When a "Contact" is selected i want to search for all related "Location" objects for that contact and place them in field 2 as options.
3. When options are loaded or when User selected the "Contact" in field #1 i want to enable field #2.
4. User selects "Location" (UBN)

                            Select::make('relation')
                                ->searchable()
                                ->label('Relatie')
                                ->live()
                                ->options(
                                    auth()->user()->relations->mapWithKeys(function ($relation) {
                                        return [$relation->id => $relation->full_name];
                                    })
                                ),
                            Select::make('ubn')
                                ->searchable()
                                ->label('UBN')
                                ->disabled(empty($this->data['relation']))
                                ->options(fn (Get $get
                                ): Collection|array => ! empty($get('relation')) ? Contact::find($get('relation'))->locations()->pluck('ubn',
                                    'id') : ['#' => 'Selecteer eerst een relatie']
                                ),
                            Select::make('relation')
                                ->searchable()
                                ->label('Relatie')
                                ->live()
                                ->options(
                                    auth()->user()->relations->mapWithKeys(function ($relation) {
                                        return [$relation->id => $relation->full_name];
                                    })
                                ),
                            Select::make('ubn')
                                ->searchable()
                                ->label('UBN')
                                ->disabled(empty($this->data['relation']))
                                ->options(fn (Get $get
                                ): Collection|array => ! empty($get('relation')) ? Contact::find($get('relation'))->locations()->pluck('ubn',
                                    'id') : ['#' => 'Selecteer eerst een relatie']
                                ),


Above simply does not load any options for field #2 (UBN) but this is mainly because the
->disabled(empty($this->data['relation']))
->disabled(empty($this->data['relation']))
cause removing this let's both fields work as expected. But you can imagine that having the second field disabled when there is no option selected in the first field would be more user friendly.

Am i doing something wrong or is this simply not possible?
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

Live select field not found with $get
FilamentFFilament / ❓┊help
2y ago
Textarea and select field disabled() issue
FilamentFFilament / ❓┊help
2y ago
Select with live() and searchable()
FilamentFFilament / ❓┊help
16mo ago
Select component with searchable & live?
FilamentFFilament / ❓┊help
3y ago