Checkboxlist: Options can't be checked separately

For some reason, if I check one option all options get checked and vise versa. What am I missing? I'm using it in a custom livewire component:
public ?array $data = [];

public function form(Form $form): Form
{
return $form
->schema([
CheckboxList::make('technologies')
->options([
'tailwind' => 'Tailwind CSS',
'alpine' => 'Alpine.js',
'laravel' => 'Laravel',
'livewire' => 'Laravel Livewire',
]),
])
->statePath('data');
}
public ?array $data = [];

public function form(Form $form): Form
{
return $form
->schema([
CheckboxList::make('technologies')
->options([
'tailwind' => 'Tailwind CSS',
'alpine' => 'Alpine.js',
'laravel' => 'Laravel',
'livewire' => 'Laravel Livewire',
]),
])
->statePath('data');
}
Thank you!
Solution:
Make sure you are calling $this->form->fill() in the mount method.
Jump to solution
3 Replies
Florian Langer
Florian LangerOP6mo ago
somehow, when removing ->statePath('data') fixes the issue. But that can't work, because I need the form data to be present.
Solution
awcodes
awcodes6mo ago
Make sure you are calling $this->form->fill() in the mount method.
Florian Langer
Florian LangerOP6mo ago
thank you! I missed that one.
Want results from more Discord servers?
Add your server