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

Wire:model not updating on change #12

Open
jasonspick opened this issue Dec 14, 2020 · 4 comments
Open

Wire:model not updating on change #12

jasonspick opened this issue Dec 14, 2020 · 4 comments

Comments

@jasonspick
Copy link

I'm not sure how this works since there is no documentation, but when a value is selected there is no change to the model.

<livewire:user-select wire:model="selectedUser" wire:change="change" name="user_id" value="$selectedUser" placeholder="Choose A User" />

the parent component echos the value selectedUser, but it never changes. If you do this in a standard input form like livewire documents suggest. it works. Am I missing something?

@Neoglyph
Copy link

From what I've seen the livewire select component currently just emits an event when it changes values, so as a workaround for the time being you could catch it with a listener like below.
What I've done after looking at the code (particularly this part) is something like this:

<livewire:selects.advert-format-select
            name="mediaFormatId"
            :value="$mediaFormatId" />
protected $listeners = [
        'mediaFormatIdUpdated' => 'setMediaFormatId',
];

public function setMediaFormatId($object)
{
        $this->mediaFormatId = $object['value'];
}

@risqiromadhoni
Copy link

hello @Neoglyph still not working for me

@Neoglyph
Copy link

hello @Neoglyph still not working for me

Which part?
Did you create the select class correctly, did you call the listener the correct way and in the correct component class, ...
Without an example of your code I can't really help much, not knowing what the issue is.

@jcroot
Copy link

jcroot commented Apr 15, 2021

Thanks for sharing this solution. I spend a few days to understand how can get the value, and only need to include a listener into my component and all this.

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

4 participants