In the filament forms package, there is a Select component.
This component does not work with searchable and disabled at the same time.
I noticed in the select.blade.php there is no isDisabled being passed to the select.js.
In there, where choices-js is used, there is no such line as when the input is disabled, you disable the input.
So what happens now is if you disable a select input, it looks like the input is disabled, but when you click on it (with searchable on) you can still change it
Expected behavior
Expected to happen is when you have searchable and disabled both at the same time, that the input is disabled based on your conditions.
Simply have a variable with a count or something close to it, or another input to test it out
This is what i have, but simply combine searchable with a disabled state after another input is set.
In my test project you can set quantity above 0, select a field, it appears disabled but in fact its not disabled you can still click on it.
Select already injects isDisabled, simply pass it to the selectFormComponent and make sure in the select.js it is disabled based on that param :)
READ THIS TOO!
You might want to consider adding a readonly instead of disabled() since disabled will also make it stop working in a POST request.
As in our scenario we want to make a field disabled after another field has been set, but disabled even after the value is set will not make it POST, readonly will.
Package
filament/filament
Package Version
3.2.72
Laravel Version
10.48.10
Livewire Version
3.4.12
PHP Version
8.3.6
Problem description
Hi there,
In the filament forms package, there is a Select component. This component does not work with searchable and disabled at the same time.
I noticed in the select.blade.php there is no isDisabled being passed to the select.js. In there, where choices-js is used, there is no such line as when the input is disabled, you disable the input.
So what happens now is if you disable a select input, it looks like the input is disabled, but when you click on it (with searchable on) you can still change it
Expected behavior
Expected to happen is when you have searchable and disabled both at the same time, that the input is disabled based on your conditions.
Steps to reproduce
Simply have a variable with a count or something close to it, or another input to test it out This is what i have, but simply combine searchable with a disabled state after another input is set.
In my test project you can set quantity above 0, select a field, it appears disabled but in fact its not disabled you can still click on it.
https://github.com/filamentphp/filament/assets/60341437/d2651513-0f31-42b4-b47b-d0b31cdb1ca1
Select already injects isDisabled, simply pass it to the selectFormComponent and make sure in the select.js it is disabled based on that param :)
READ THIS TOO!
You might want to consider adding a readonly instead of disabled() since disabled will also make it stop working in a POST request. As in our scenario we want to make a field disabled after another field has been set, but disabled even after the value is set will not make it POST, readonly will.
Reproduction repository
https://github.com/nielsvh2103/filament-select-disabled-issue
Relevant log output
No response