Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Livewire no sync #9

Open
arnaudlidz opened this issue Mar 31, 2022 · 1 comment
Open

Livewire no sync #9

arnaudlidz opened this issue Mar 31, 2022 · 1 comment

Comments

@arnaudlidz
Copy link

Hello,

First, thanks for this plugin.

I run in troubles with Livewire where the hidden input don't get the value from the user input. So I used your trick about refresh and it works.

But, and maybe because, the hidden input where the wire:model is can't sync with Livewire when it's updated by JS.

So I had to add theses line to get it works in my x-init :
initPhone() { let vm = this; document.querySelector("#phone").addEventListener('telchange', function(e) { if(e.detail.valid) { vm.phone = e.detail.validNumber; } }); }

And phone: @entangle('phone').

Is there a better way ?

Have a nice day.
Arnaud

@mrsid18
Copy link

mrsid18 commented Mar 31, 2022

You can just use wire:model.lazy (lazy loading) and it'll work as expected.

And the hidden input will only update if the format is correct/valid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants