Replies: 1 comment 2 replies
-
|
You need to do that second part (currently). essentially, things are handled from start to finish, so the model on the select happens before the x-for has filled in the options, meaning the corresponding option doesn't actually exist when the model happens. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
So I display it here, I have an option select if these values:
<option value="">-- Select --</option> <template x-for="m in exam.months" :key="m.value"> <option :value="m.value" x-text="m.text"></option> </template>
exam.months = [{"id":1,"value":"1","text":"May/June"},{"id":2,"value":"2","text":"Nov/Dec"}]exam.month = 1.
It doesnt select any option in the drop down.
<select :name="Exams[${index}].Month`"x-model="exam.month"
class="w-full border rounded px-3 py-2">
`
Still same, it only selects when I add :selected="m.value === exam.month"
what am I getting wrong, since I don't want to be setting :selected like that
Beta Was this translation helpful? Give feedback.
All reactions