Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

RTIAGOF's avatar

Livewire with Alpine and Choices.js

Hi, i am trying to use Choices.js on my selects however when i am saving or creating a new entry to the database the wire:model finds the old value but does not display the current option. here is my code:

<x-select.choices :options="$areas" wire:model="area_id" name="area_id" id="area_id"/>

<select
    {{ $attributes }}
    x-data
    x-init="new Choices($el, {
        searchEnabled: false,
        allowHTML: true
    })"
    :multiple
>

    <option value="">Select</option>

    @foreach($options as $option)
        <option value="{{ $option->id }}">{{ $option->name }}</option>
    @endforeach

</select>

Any ideas?

Thank you

0 likes
3 replies
RTIAGOF's avatar

Hey @snapey thank you for your reply. i have had a try at setting choices before but didn't really manage to get it working with it not sure what i am doing wrong.. but will give another go on that. thank you

RTIAGOF's avatar

Hi, just to close this conversation, my issue was wire:ignore on the parent. cheers and thanks again for the help @snapey .

Please or to participate in this conversation.