© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
16 replies
Andrew Wallo

Problem with Reactive Searchable Select

Recently I started getting this weird error whenever I try to submit a form using this:
Forms\Components\Select::make('region')
    ->label('Province/State')
    ->disabled(static fn (callable $get) => $get('country') === null)
    ->options(static function (callable $get) {
        $country = $get('country');

        if (! $country) {
           return [];
        }

        return Contact::getRegionOptions($country);
    })
    ->searchable(static fn (Forms\Components\Select $component) => !$component->isDisabled()),
Forms\Components\Select::make('region')
    ->label('Province/State')
    ->disabled(static fn (callable $get) => $get('country') === null)
    ->options(static function (callable $get) {
        $country = $get('country');

        if (! $country) {
           return [];
        }

        return Contact::getRegionOptions($country);
    })
    ->searchable(static fn (Forms\Components\Select $component) => !$component->isDisabled()),

The callback inside the
searchable()
searchable()
method is actually necessary in order for the form to be reactive when using
disabled()
disabled()
(because searchable selects can't be disabled). Anyways, I recently started to get this weird error.

Upon further investigation, the error does not occur when I remove the callback inside the
searchable()
searchable()
method, which basically means I won't be able to have a reactive searchable Select unless I find the fix for this.

This works and no error occurs:
Forms\Components\Select::make('region')
    ->label('Province/State')
    ->disabled(static fn (callable $get) => $get('country') === null)
    ->options(static function (callable $get) {
        $country = $get('country');

        if (! $country) {
           return [];
        }

        return Contact::getRegionOptions($country);
    }),
Forms\Components\Select::make('region')
    ->label('Province/State')
    ->disabled(static fn (callable $get) => $get('country') === null)
    ->options(static function (callable $get) {
        $country = $get('country');

        if (! $country) {
           return [];
        }

        return Contact::getRegionOptions($country);
    }),

Please help!
Screenshot_2023-07-02_214828.png
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::searchable() is not reactive?
FilamentFFilament / ❓┊help
3y ago
Searchable and reactive select fields not functioning
FilamentFFilament / ❓┊help
2y ago
Issue With Searchable Select
FilamentFFilament / ❓┊help
2y ago
Select searchable
FilamentFFilament / ❓┊help
2y ago