I have in the order form a input text field that is binding to the accountForm property. I also have a input checkbox, bound to isChecked, if it is marked, the user account is also updated when the order is created. The checkbox is unchecked at the beginning (isChecked = false), but when the customer changes the input text, the updateAccountForm method in the class changed the property isChecked = true. This works, verified with dd, but the checkbox in the blade view remains unchecked. I am asking for your help in solving the problem. I have a feeling that it worked in Livewire 2.
I think there is a problem with re-hydration
Thanks for help.
// livewire class
public $accountForm = [
'name' => '',
'phone' => '',
];
public $isChecked = false;
public function updatedAccountForm()
{
$this->isChecked = true;
// dd($this->isChecked); // verified if update works
}
// blade view
<input id="name" type="text" name="name" wire:model.live.debounce.500ms="accountForm.name" />
<input id="phone" type="text" name="phone" wire:model.live.debounce.500ms="accountForm.phone" />
{{-- this checkbox is not checked after a change in class, i trying wire:model or wire:model.live --}}
<label for="updateAccount">Update account</label><input id="updateAccount" wire:model.live="updateAccount" type="checkbox" name="updateAccount" />
{{-- property value verification --}}
{{ $isChecked }}
I searched for a solution on stackoverflow, laracast, etc., but without success.
Marek Vinárčik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.