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

Kazuto's avatar

Vue not getting array values

If I select a checkbox vue does not give any values to the array, even though the items have a value as I checked the DOM Tree.

<div class="column">
    <div class="card">
        <div class="card-content">
            <label for="players" class="label">{{ trans_choice('sites.players', 2) }}</label>
            <input type="hidden" name="players" :value="playerSelected">

            <b-checkbox-group v-model="playerSelected">
                @foreach ( $players as $player )
                <div class="field">
                    <b-checkbox :custom-value="{{ $player->id }}">{{ $player->nickname }}</b-checkbox>
                </div>
                @endforeach
            </b-checkbox-group>
        </div>
    </div>
</div><!--column-->

<script>
    var app = new Vue({
        el: '#app',
        data: {
            playerSelected: {!! $team->players->pluck('id') !!},
            gameSelected: {!! $team->games->pluck('id') !!}
        }
    });
</script>
0 likes
3 replies
Kazuto's avatar

@topvillas <input type="hidden" name="players" v-model="playerSelected"> isn't working either.

Please or to participate in this conversation.