© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
1 reply
Adnan Smlatić

Force refresh a Select to update disableOptionWhen()?

Hey, I would really apprecaite some pointers in the right direction here, I've tried absolutely everything I can think of.

In my Select implementation, I am trying to Remove/Disable options in real-time based on current selection.

The code below works, however, the options are only updated when you exit focus from the Select and click on it again.

What could I do to force the options to refresh whenever the state is changed?

Or is there a better way to approach this? The goal is to be able to select only x1 Category of each type.

Eg: If the select is showing (A1, A2, A3, B1,B2, B3) and you select A1, I want to immediately remove/disable (A2, A3) and the new options state would be ( B1,B2, B3).

I have been able to do it with validation, but it is not ideal.

    Forms\Components\Select::make('categories')
        ->relationship('categories', 'name')
        ->multiple()
        ->preload()
        ->live()
        ->options(fn (Get $get) => static::getCategoryOptions($get))
        ->disableOptionWhen(function (string $value, Get $get): bool {
            return static::shouldDisableCategory($value, $get);
        })

    
    Forms\Components\Select::make('categories')
        ->relationship('categories', 'name')
        ->multiple()
        ->preload()
        ->live()
        ->options(fn (Get $get) => static::getCategoryOptions($get))
        ->disableOptionWhen(function (string $value, Get $get): bool {
            return static::shouldDisableCategory($value, $get);
        })

    
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

disableOptionWhen in Select
FilamentFFilament / ❓┊help
2y ago
disableOptionWhen
FilamentFFilament / ❓┊help
2y ago
Select disableOptionWhen() not working when using searchable()
FilamentFFilament / ❓┊help
3y ago
DateRangeFilter - Table doesn't update until I force refresh
FilamentFFilament / ❓┊help
10mo ago