0

I have a select and options in my form but i would like to prepopulate the select with old selected data but i can't seem to get it to work.

Here is my code

<select name="holding_id" v-model="service.holding_id">
              <option value="">Select a holding group</option>
              <option v-for="holding in holdings" v-bind:key="holding.id" v-bind:value="holding.id">
                             {{ holding.holding_name }}
              </option>
  </select>

I am thinking using javascript ternary would make sense

  • 1
    Does this answer your question? [Set default value to option select menu](https://stackoverflow.com/questions/41122028/set-default-value-to-option-select-menu) –  Jan 07 '22 at 12:30
  • 1
    *v-model will ignore the initial value, checked, or selected attributes found on any form elements. It will always treat the Vue instance data as the source of truth. You should declare the initial value on the JavaScript side, inside the data option of your component.* - [docs](https://vuejs.org/v2/guide/forms.html#Basic-Usage) – Michal Levý Jan 07 '22 at 12:46

0 Answers0