Bimby13
Dynamic Dropdown Not Working In Repeater
Hi everyone,
I'm facing an issue with a dynamic dropdown in a Repeater within a Filament form. Here's the relevant code:
return $form
->schema([
Tabs::make('Tabs')
->tabs([
Tab::make('Basic Info')
->icon('heroicon-m-circle-stack')
->schema([
Select::make('brand_id')
->label('Brand')
->options(Brand::all()->pluck('name', 'id')->toArray())
->live()
->searchable()
->preload()
->afterStateUpdated(function (Set $set) {
$set('store_type_id', null);
}),
Repeater::make('purfDualScreenPosImages')
->label('')
->relationship()
->schema([
Select::make('store_type_id')
->label('Store Type')
->options(function (callable $get) {
return StoreType::query()
->where('brand_id', $get('brand_id'))
->pluck('name', 'id');
})
->searchable()
->preload(),
])
->addActionLabel('Add Dual Screen POS')
->columnSpanFull(),
]),
])
->activeTab(1)
->columnSpanFull(),
]);
The Problem:
The store_type_id dropdown in the Repeater is supposed to update based on the selected brand_id, but it remains static and does not reflect the dynamic options as intended.
Steps Taken
I tried to move it outside repeater and its work properly.
Any help would be greatly appreciated!
Thanks in advance!
5 replies