Select field with Checkbox
Hello again all,
I want to disable a basic select field when checkbox is checked, I made both components reactive and getting the checkbox component's state in disabled closure correctly, even Select disabled function gets called after checkbox updated
But the even if checkbox disabled state returning false, select disabled state is not changing. It stays same as if the first page load state. Am I missing something?
Here is my code;
I want to disable a basic select field when checkbox is checked, I made both components reactive and getting the checkbox component's state in disabled closure correctly, even Select disabled function gets called after checkbox updated
But the even if checkbox disabled state returning false, select disabled state is not changing. It stays same as if the first page load state. Am I missing something?
Here is my code;
Checkbox::make('send_all_users')
->label('Send to everyone')
->inline()
->reactive(),
Select::make('branch_ids')
->reactive()
->label('Choose branch ids')
->hint('Seçili şube üyelerine gönderin')
->multiple()
->searchable()
->options(fn () =>
Branch::where('corp_id', $authUser->corp_id)
->get()
->pluck('title', 'id')
)
->disabled(function (Closure $get) {
error_log('send_all_users: ' . !boolval($get('send_all_users')));
return !boolval($get('send_all_users'));
}),