© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•6mo ago•
2 replies
gg

Auto Select Issue in Select Option

4️⃣v4
when I try to auto select of cityids and it working well but it can also select value after auto selected.so that can cause duplicate

Select::make('country_id')
->label('Country')
->reactive()
->required()
->placeholder('Please select a country')
->preload()
->searchable()
->options(Country::pluck('name', 'id'))
->afterStateUpdated(function ($state, Set $set) {
if ($state) {
$cities = City::where('country_id', $state)->pluck('id')->toArray();
$set('city_ids', $cities);
} ),

Select::make('city_ids')
->label('City')
->placeholder('Please select your cities)
->multiple()
->preload()
->searchable()
->reactive()
->options(function (Get $get) {
$country_id = $get('country_id');
if ($country_id) {
return City::where('country_id', $countryId)->pluck('name', 'id');

}

return [];
}),
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 preload() option loading issue
FilamentFFilament / ❓┊help
3y ago
Pagination in select option
FilamentFFilament / ❓┊help
3y ago
Select All option in relationship Select
FilamentFFilament / ❓┊help
2y ago
Filament Select Field Option Display Issue
FilamentFFilament / ❓┊help
11mo ago