I am using Vue-select and want to make the drop-down mandatory, but looks like it is not working.
Tried the required, rules but had no luck.
<v-select label="name"
:close-on-select="true"
v-model="CurrentAssignment"
v-on:input="onSelection"
:reduce="app => app.id"
placeholder="Select"
:options="EligibleOptions" :clearable="false"
>
</v-select>
Appreciate any inputs.
I assume you are using Vue-select (by looking at the
reduceprop andv-selectsyntax). A validation guide is already available in the documentation. You need to use therequiredprop in combination with the search-scoped slot.Here is a demo in which when submit event will be triggered the selection dropdown will show an error and open automatically.
Note- I used the form's submit event to trigger the validation. You can use your submission logic.