Select Field selected

Hey Guy’s

I have a select field with values from a table that I would like to compare with another table and mark as selected if a value matches.

                                <select name="tour" class="form-control form-control-sm" wire:model="selectTour">
                                    @foreach($touren as $tour)
                                        <option {{ $beleg->Tour == $tour->Gruppe ? 'selected' : '' }} value="{{ $tour->Gruppe }}">{{ $tour->Gruppe }}</option>
                                    @endforeach
                                </select>

If I now reload the page, the matching value is briefly marked as selected, but automatically jumps back to “Please select”.

If I remove wire:model=“selectTour” it works. But can’t perform any actions with the select field.

Can anyone Help?

yes you could…in select don’t bind the property, try to handle by the change of it

<select name="tour" class="form-control form-control-sm" wire:change="selectItem($event.target.value)">

and in component

public function selectItem($item)
{
    $this->selectTour = $item;
}