mlutz
29
2
Vue

Form with array - problem with select options

Posted 4 months ago by mlutz

Hello, i need a form to edit some data. From the Api I receive the following data

[{"id":1,"firstname":"Emma","lastname":"Gomez","tdate":"2018-03-03","visit":"X"},{"id":2,"firstname":"Jacob","lastname":"Miller","tdate":"2018-03-03","visit":"D"}...

I would like to list the data and change the visit-state.

 <ul v-if="players">
            <li v-for="{ id, firstname, lastname } in players">
            {{ firstname }} {{ lastname }} 
                <select>
                <option value="X">Present</option>
                <option value="E">Excuse</option>
                <option value="D">Diseased</option>
                </select>
          </li>
        </ul>

My first problem: How can i list the received data? The players are displayed. But the old Value is not selected and in the second step i want to save the changes to the api. Thanks for help.

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.