Skip to content

select variant=listbox not displaying wire:model value #453

Description

@nicolaslefresne

Hello!

I'm encountering an issue when using select variant=listbox.

I'm using a livewire component with a $profiles property containing the following sample Eloquent collection that I want to use as a source in a select:

[
    [
        "id" => 1,
        "name" => "profile1",
    ],
    [
        "id" => 2,
        "name" => "profile2",
    ],
]

I also have a property $subscriber_profile_id = 1 matching my first profile.

Consider the basic select example below:

<flux:select label="Profile" wire:model="subscriber_profile_id">
    @foreach ($profiles as $profile)
        <flux:option wire:key="{{ $profile->id }}" value="{{ $profile->id }}">
            {{ $profile->name }}
        </flux:option>
    @endforeach
</flux:select>

It works just fine:
Image

As you can see the $subscriber_profile_id (containing the value 1) is correctly displayed using the wire:model property.

But whenever I use the variant=listbox:

<flux:select label="Profile" variant="listbox" wire:model="subscriber_profile_id">
    @foreach ($profiles as $profile)
        <flux:option wire:key="{{ $profile->id }}" value="{{ $profile->id }}">
            {{ $profile->name }}
        </flux:option>
    @endforeach
</flux:select>

Image

The field does not select the associated select value.

Am I missing something here or is that a bug?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions