© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•9mo ago•
51 replies
Hasan Tahseen

Searchable Not Working When Preload is Set For Select Field With relationship

I have this code

Forms\Components\Select::make('product_id')
    ->label('Product')
    ->required()
    ->preload()
    ->searchable()
    ->relationship('product', 'title')
    ->prefixIcon(IconEnum::PRODUCT->value)
    ->placeholder('Select a product')
    ->helperText('Product this promo code applies to'),
Forms\Components\Select::make('product_id')
    ->label('Product')
    ->required()
    ->preload()
    ->searchable()
    ->relationship('product', 'title')
    ->prefixIcon(IconEnum::PRODUCT->value)
    ->placeholder('Select a product')
    ->helperText('Product this promo code applies to'),


when the preload is set the searchable will not work because of this code in filament select field

public function hasDynamicSearchResults(): bool
{
    if ($this->hasRelationship() && empty($this->searchColumns)) {
        return ! $this->isPreloaded();
    }

    return $this->getSearchResultsUsing instanceof Closure;
}
public function hasDynamicSearchResults(): bool
{
    if ($this->hasRelationship() && empty($this->searchColumns)) {
        return ! $this->isPreloaded();
    }

    return $this->getSearchResultsUsing instanceof Closure;
}

above code will block the code of
$this->getSearchResultsUsing
$this->getSearchResultsUsing
which defined in the
relationship
relationship
method.
My question is why is that? In my use cases I want to preload the data at first with some limit and allow user to search for the rest of the data.
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
Next page

Similar Threads

Select field ->preload() not working in relationship manager attach action
FilamentFFilament / ❓┊help
3y ago
Select input not working when searchable is appended
FilamentFFilament / ❓┊help
16mo ago
Setting searchable select field to null not working
FilamentFFilament / ❓┊help
3y ago
Select disableOptionWhen() not working when using searchable()
FilamentFFilament / ❓┊help
3y ago