F
Filament15mo 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
Filament15mo ago
Please upgrade to the latest Filament version using composer update.
Hotcat
Hotcat15mo ago
Use ->hidden( instead of ->when(
Dennis Koch
Dennis Koch15mo ago
Check the docs for dependable selects
Solution
Noxo
Noxo15mo ago
1. Select::make('type')->reactive() 2. Repeater::make('options')->hidden(fn(callable $get) => $get('type') == 'select')
Dennis Koch
Dennis Koch15mo ago
It’s in the advanced form section
Omar
OmarOP15mo ago
this way worked for me, thank you very much
Dennis Koch
Dennis Koch15mo 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
OmarOP15mo ago
I'll keep it in mind, thanks
Noxo
Noxo15mo 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/
Want results from more Discord servers?
Add your server