i am using updated hook to update another wire:model value, if i dd or print the variable in the view i can see updated value but not in input itself
Same logic was working file on livewire 2
codes
{{ $customerCode }}
<input wire:model.live="customerCode" type="text" id="customer_code" name="customer_code" class="form-control" placeholder="" />
<input type="text" wire:model.blur="name" class="form-control" placeholder="John Doe"/>
{{-- on changing this it run a updatedName hook runs and i can seed printed on view on above $customerCode but on in input --}}
Component Code
public function updatedName(){
$this->customerCode = 'random string';//generateUniqueUserCode($this->name);
}
2
Answers
I think I understood what you want to do, you may misunderstand the role of live model:
I suggest that you abondon puting customerCode inside live-modal, print it simply as a text, since it’s not up to the user to generate their code.
I will try to give you a complete example:
Component Class
Component Blade
please notice that I didn’t put ‘wire:model’ attribut on the first input.
hope you find this useful, I try it on my local and it works!