vuetify v-select required not working

jk
jk
34 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.

Views: 27577
Total Answered: 2
Total Marked As Answer: 1
Posted On: 05-Jan-2019 03:34

Share:   fb twitter linkedin
Answers
Stevan
Stevan
312 Points
20 Posts
         

I found an example on codepen:

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

Posted On: 05-Jan-2019 04:24
beginer
beginer
1544 Points
52 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
 Log In to Chat