Dynamically disabling the Select Input
Is it possible in the Form Builder?
7 Replies
Normal select or searchable select?
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
It's just an example π There's also a
->disabled()
method.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
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 youUnfortunately 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