Answer Detail

vuetify v-select required not working

jk
jk
2 Points
1 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
18 Points
9 Posts
     

I found an example on codepen:

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

Posted On: 05-Jan-2019 04:24
beginer
beginer
52 Points
21 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 (1)

 Log In to Chat