F
Filament14mo 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
awcodes14mo 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
Zakhaev14mo ago
Thank you for your answer, i will try it out and let it know. I appreciate it
Zakhaev
Zakhaev14mo ago
I watched the video and read the documentation. I wonder why this doesnt work, i thought it would
Zakhaev
Zakhaev14mo 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
toeknee14mo ago
->disabled( fn(Closure $get) => !$get('custom_branche_checkbox'))
->disabled( fn(Closure $get) => !$get('custom_branche_checkbox'))
Zakhaev
Zakhaev14mo ago
Thank you it works perfect !!
toeknee
toeknee14mo ago
Please create your own post.
Want results from more Discord servers?
Add your server