© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
3 replies
Aminne

Failed to disabled select before another select

Forms\Components\Select::make('from_id')
                        ->relationship(name: 'from',
                            modifyQueryUsing: fn (Builder $query, Get $get) => $query->where('id', '!=', $get('to_id')))
                        ->getOptionLabelFromRecordUsing(fn (Model $record) => "{$record->holder->name}")
                        ->preload()
                        ->searchable()
                        ->required()
                        ->live()
                        ->native(false),Forms\Components\Select::make('to_id')
                        ->relationship(name: 'to',
                            modifyQueryUsing: fn (Builder $query, Get $get) => $query->where('id', '!=', $get('from_id')))
                        ->getOptionLabelFromRecordUsing(fn (Model $record) => "{$record->holder->name}")
                        ->disabled(function(Get $get) {
                            return is_null($get('from_id'));
                        })
                        ->live()
                        ->preload()
                        ->searchable()
                        ->required()
                        ->native(false)
Forms\Components\Select::make('from_id')
                        ->relationship(name: 'from',
                            modifyQueryUsing: fn (Builder $query, Get $get) => $query->where('id', '!=', $get('to_id')))
                        ->getOptionLabelFromRecordUsing(fn (Model $record) => "{$record->holder->name}")
                        ->preload()
                        ->searchable()
                        ->required()
                        ->live()
                        ->native(false),Forms\Components\Select::make('to_id')
                        ->relationship(name: 'to',
                            modifyQueryUsing: fn (Builder $query, Get $get) => $query->where('id', '!=', $get('from_id')))
                        ->getOptionLabelFromRecordUsing(fn (Model $record) => "{$record->holder->name}")
                        ->disabled(function(Get $get) {
                            return is_null($get('from_id'));
                        })
                        ->live()
                        ->preload()
                        ->searchable()
                        ->required()
                        ->native(false)
Firstly to_id select is disabled before selected the from_id i have this code , The problem after select the from_id , to_id is disabled but i can't open the options ?
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

Select Option Disabled Based on Another Field's Value
FilamentFFilament / ❓┊help
12mo ago
Select disabled not working
FilamentFFilament / ❓┊help
2y ago
How to disabled select in form
FilamentFFilament / ❓┊help
17mo ago
Select Remove Button to Be disabled
FilamentFFilament / ❓┊help
2y ago