vuetify v-select required not working

jk
jk
4 Points
2 Posts

I'm using v-select to show gender and put required as:

<v-select
      label="Gender"
      v-model="model.Gender"
      :items="genders"
      required
    ></v-select>
model.Gender: null;
Gender: [
          'Male',
          'Female',
          'Other'
        ];

But it does not working and it's not validating as required field.

Total Answered: 2
Total Marked As Answer: 0
Posted On: 05-Jan-2019 03:34

Share:   fb twitter linkedin
Answers
Stevan
Stevan
24 Points
12 Posts
     

I found an example on codepen:

https://codepen.io/nelxaz/pen/xLemZB

Posted On: 05-Jan-2019 04:24
beginer
beginer
64 Points
27 Posts
     

You need to use custom rules to validate v-select in vuetify:

<v-select
      label="Gender"
      v-model="model.Gender"
      :items="genders"
      :rules="[(v) => !!v || 'Gender is required']"
      required
    ></v-select>
Posted On: 05-Jan-2019 04:28
banner

Blog

Active User (2)

 Log In to Chat