FilamentF
Filament3y ago
Igor

Conditional Select options don`t work if disabled field

Hi guys, seems a bug to me.
I'm trying enable and add options dynamically in a select after another select changes, but if I add the disabled option in the second select, it not add any option, if I remove it, works like a charm

Select::make('cliente_id') ->relationship('cliente', 'nome') ->searchable() ->live(onBlur: true) ->required(), Select::make('veiculo_cliente') ->required() ->disabled(fn (Get $get): bool => ! $get('cliente_id')) ->native(false) ->allowHtml() ->options(function (Get $get) { $id = $get('cliente_id'); if (!$id) { return []; } return Cliente::find($id)->veiculos->map( function (array $veiculo) { return view('veiculoSelectItem',$veiculo)->render(); })->toArray(); })
Was this page helpful?