Level 5
The wire:model.live modifier needs to be added to update the component.
https://livewire.laravel.com/docs/components#binding-inputs-to-properties
wire:model.live="selectedCountry"
wire:model.live="selectedState"
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi In Livewire3, "Select Country" it don't send request to updatedSelectedCountry and don't updating $cities
class DependentDropdown extends Component
{
public $countries;
public $states;
public $cities;
public $selectedCountry;
public $selectedState;
public function mount()
{
$this->countries = Country::all();
}
public function updatedSelectedCountry($value)
{
$this->states = State::where('country_id', $value)->get();
$this->cities = [];
}
public function updatedSelectedState($value)
{
$this->cities = City::where('state_id', $value)->get();
}
public function render()
{
return view('livewire.dependent-dropdown');
}
}
<div>
<label for="country">Country:</label>
<select wire:model="selectedCountry" id="country">
<option value="">Select Country</option>
@foreach ($countries as $country)
<option value="{{ $country->id }}">{{ $country->name }}</option>
@endforeach
</select>
</div>
@if (!empty($states))
<div>
<label for="state">State:</label>
<select wire:model="selectedState" id="state">
<option value="">Select State</option>
@foreach ($states as $state)
<option value="{{ $state->id }}">{{ $state->name }}</option>
@endforeach
</select>
</div>
@endif
@if (!empty($cities))
<div>
<label for="city">City:</label>
<select id="city">
<option value="">Select City</option>
@foreach ($cities as $city)
<option value="{{ $city->id }}">{{ $city->name }}</option>
@endforeach
</select>
</div>
@endif
Please or to participate in this conversation.