Closed gergo85 closed 12 months ago
Please read the docs: https://filamentphp.com/docs/3.x/forms/getting-started#dependant-fields.
Your first field should be live()
.
I used live() but no change.
With or without native(false)
on the second field? Because the non-native select field doesn't support dynamically disabling it due to a limitation with Choices.js.
Thanks for the quick response. Unfortunately, it doesn't work in either case.
@gergo85 with both select native it works but not on the first load because ->default()
doesn't seem to change the value of the select.
It looks like even if you have have ->default(1)
on the first select, on the first load $get('print_all')
is null
.
If you change the value to 'No' and back to 'Yes' it correctly disable the second select.
A possible workaround is to ->disabled()
to check when $get('print_all')
is null
or 1.
Another is to remove both ->selectablePlaceholder(false)
and ->default(1)
to leave the user choose an option on the first select and trigger the disabling of the second.
I just saw the other issue, so I would say it is related to #8776.
Thanks, @ilpav12. Closing as dupe.
Package
filament/forms
Package Version
v3.0.62
Laravel Version
10.25.1
Livewire Version
No response
PHP Version
8.2.4
Problem description
To create an interactive form, one select field should affect another. I use advanced disable option, but nothing happened.
Expected behavior
The field is not disabled.
Steps to reproduce
I use this example code: ->disabled(fn (Get $get) => $get('print_all') == 1)
Reproduction repository
https://github.com/gergo85/filament-test-selectfield
Relevant log output
No response