Livewire: Bind refresh not working from server to client for input type

I have a laravel livewire (v3) component that contains an input field. I'm trying to get the displayed field to refresh after the bound (bind-ed) property is updated server-side.

Livewire component:

<?php

namespace App\Livewire\MyNamespace;

use Livewire\Component;

class Create extends Component
{

    public function rules()
    {
        return [
            'doSomething' => 'required',
        ];
    }

    public $doSomething = '';

    public function add()
    {
        $this->doSomething = 'Welcome';
        $this->dispatch('$refresh');
    }

    public function render()
    {
        return view('livewire.create');
    }
}

The view is simple:

<div>
<button class="btn btn-primary" wire:click="add">Press me</button>
<input type="text" wire:model.live="doSomething">
Label: 
</div>

When I press the button, the input field displayed isn't updated, but the text is rendered in the label - any ideas? Does an input binding only work one way, client to server?



Comments

Popular posts from this blog

Spring Elasticsearch Operations

Object oriented programming concepts (OOPs)

Spring Boot and Vaadin : Filtering rows in Vaadin Grid