BearRoot
ToggleButtons are requiring a double-click to change their state
return $form
->schema([
Forms\Components\TextInput::make('aaa')
->default('aaaaaa')
->disableAutoComplete(), // Add this to prevent focus stealing
Forms\Components\ToggleButtons::make('lecturer_type')
->inline()
->multiple()
->default(["practice"])
->options([
'practice' => __('Practice'),
'lecture' => __('Lecture')
])
->colors([
'practice' => 'info',
'lecture' => 'warning',
])
->icons([
'practice' => 'heroicon-o-pencil',
'lecture' => 'heroicon-o-check-circle',
])
->required()
->afterStateUpdated(function ($state) {
// Force immediate state update
$this->validateField('lecturer_type');
}),
])
->beforeFill(function ($form) {
// Ensure clean state before filling
$form->getRecord()->setAttribute('lecturer_type', []);
});
return $form
->schema([
Forms\Components\TextInput::make('aaa')
->default('aaaaaa')
->disableAutoComplete(), // Add this to prevent focus stealing
Forms\Components\ToggleButtons::make('lecturer_type')
->inline()
->multiple()
->default(["practice"])
->options([
'practice' => __('Practice'),
'lecture' => __('Lecture')
])
->colors([
'practice' => 'info',
'lecture' => 'warning',
])
->icons([
'practice' => 'heroicon-o-pencil',
'lecture' => 'heroicon-o-check-circle',
])
->required()
->afterStateUpdated(function ($state) {
// Force immediate state update
$this->validateField('lecturer_type');
}),
])
->beforeFill(function ($form) {
// Ensure clean state before filling
$form->getRecord()->setAttribute('lecturer_type', []);
});
27 replies