filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
18.98k stars 2.93k forks source link

Select box not disabling correctly when using closure and multiple #8935

Closed davidabadi closed 1 year ago

davidabadi commented 1 year ago

Package

filament/forms

Package Version

v3.0.69

Laravel Version

v10.26.2

Livewire Version

v3.0.5

PHP Version

PHP 8.2.5

Problem description

When using a Select input with the ability to select multiple on a form and having it disabled dinamically depending on another input (a toogle in this case) the input changes color as if it is disabled but it still allows the user to select a value. If I use the disabled property outright (->disabled()) on the select it does work as expected and it does not allow the user to select a value.

image

Expected behavior

Select box should become disabled and user is not allowed to select any value.

Steps to reproduce

Create a form with the following fields

Select::make('users')->options(User::orderBy('name')->pluck('name', 'id'))->multiple()->disabled(fn(Get $get) => $get('select_all')), Toggle::make('select_all')->live(onBlur: true)

Reproduction repository

https://github.com/davidabadi/filamentFormBug

Relevant log output

No response

zepfietje commented 1 year ago

Please search existing issues before creating a bug report. This is a duplicate of https://github.com/filamentphp/filament/issues/3068 and a couple of other dupes that have been reported since.