F
Filament17mo ago
Zakhaev

Forms / Can i use a form checkbox to show or hide other form components?

Hi people, i have a quick question. I am using filament forms to build a form. Now i have a checkbox. But i want to show other forms components if the checkbox is checked. Is there a way to do this?
Solution:
->disabled( fn(Closure $get) => !$get('custom_branche_checkbox'))
->disabled( fn(Closure $get) => !$get('custom_branche_checkbox'))
...
Jump to solution
7 Replies
awcodes
awcodes17mo ago
Yes, not sure if you're on v2 or v3 but the logic is the same. https://filamentphp.com/docs/2.x/forms/advanced#dependant-fields--components
Filament
Advanced - Form Builder - Filament
The elegant TALL stack form builder for Laravel artisans.
Zakhaev
ZakhaevOP17mo ago
Thank you for your answer, i will try it out and let it know. I appreciate it
Zakhaev
ZakhaevOP17mo ago
I watched the video and read the documentation. I wonder why this doesnt work, i thought it would
Zakhaev
ZakhaevOP17mo ago
the checkbox is on top. And in the asset_id i want to disable it based on state of checkbox am i using wrong vars?
Solution
toeknee
toeknee17mo ago
->disabled( fn(Closure $get) => !$get('custom_branche_checkbox'))
->disabled( fn(Closure $get) => !$get('custom_branche_checkbox'))
Zakhaev
ZakhaevOP17mo ago
Thank you it works perfect !!
toeknee
toeknee17mo ago
Please create your own post.
Want results from more Discord servers?
Add your server