F
Filamentβ€’16mo ago
Null Keso

Dynamically disabling the Select Input

Is it possible in the Form Builder?
7 Replies
Dennis Koch
Dennis Kochβ€’16mo ago
Normal select or searchable select?
Null Keso
Null KesoOPβ€’16mo ago
Just a normal select (multiple). Though hiding the field doesn't suite with my current requirement. I want to dynamically enable and disable the selection of options to the select input based on another input's data. For example we have two select inputs, Roles and Permission input By default the Permission is disabled then it only gets enabled when the role value is System Admin
Dennis Koch
Dennis Kochβ€’16mo ago
It's just an example πŸ˜‰ There's also a ->disabled()method.
Null Keso
Null KesoOPβ€’16mo ago
I also tried the disabled method passing a closure as well, but for some strange reason the disabled attribute in the select element doesnt get removed when the condition to enable it is true
Dennis Koch
Dennis Kochβ€’16mo ago
Not sure whether that still works with multiple. I think that might use choices.js under the hood and there still is an issue, that we cant change disabled state. Then ->hidden() is the best choice for you
Null Keso
Null KesoOPβ€’16mo ago
Unfortunately when the input is disabled it must show a certain values. Hmm imma try to look for work around on this. Thanks btw @Dennis Koch
Want results from more Discord servers?
Add your server