Closed fadyelgendy closed 2 months ago
No errors on console?
Are you sure that you have “wire:model” in place ? Please, take a look again on docs.
@robsontenorio no console errors. and here is the full scenario
model property
public array $opts = [];
component
@foreach($methods as $opt)
<x-checkbox wire:model="opts.{{$loop->index}}.method" value="{{ $opt['id'] }}" :label="$opt['name']" />
@endforeach
here is the result
The concept of multiple checkbox works differently in Livewire. https://livewire.laravel.com/docs/wire-model#multiple-checkboxes
public array $methods = ["one", "two", "three"];
public array $opts = [];
@foreach($methods as $opt)
// There is no "index" and you must bind it to an array model
<x-checkbox wire:model="opts" :value="$opt" :label="$opt" />
@endforeach
maryUI version
1.35.6
daisyUI version
4.12.10
Livewire version
3
What browsers are affected?
Firefox, Chrome
What happened?
can not change/set checkbox value. it always default to true.