F
Filament11mo ago
Omar

How can I make it work?

I have tried to generate the condition in the second repeater but the condition does not work, what I want is that if the variable inputs->type == 'Select' the repeater is shown, if not hidden
Solution:
1. Select::make('type')->reactive() 2. Repeater::make('options')->hidden(fn(callable $get) => $get('type') == 'select')...
Jump to solution
9 Replies
Filament
Filament11mo ago
Please upgrade to the latest Filament version using composer update.
Hotcat
Hotcat11mo ago
Use ->hidden( instead of ->when(
Dennis Koch
Dennis Koch11mo ago
Check the docs for dependable selects
Solution
Noxo
Noxo11mo ago
1. Select::make('type')->reactive() 2. Repeater::make('options')->hidden(fn(callable $get) => $get('type') == 'select')
Dennis Koch
Dennis Koch11mo ago
It’s in the advanced form section
Omar
Omar11mo ago
this way worked for me, thank you very much
Dennis Koch
Dennis Koch11mo ago
For explanation: Record is always the stored model and not the data in the form. That’s why $record doesn’t work Also please use more descriptive titles in the future.
Omar
Omar11mo ago
I'll keep it in mind, thanks
Noxo
Noxo11mo ago
You are welcome. but anyway, take a look at the docs, there are a lot of interesting things - https://filamentphp.com/docs/2.x/