[Vuejs]-Vee-Validate validation groups

0๐Ÿ‘

โœ…

I found the correct solution:

HTML CODE

<input type="text" name="mobilePhone" class="form-control" v-model="form.mobilePhone" v-validate ="{ rules: { required: contactInfo} }" :class="{'input': true, 'is-danger': errors.has('mobilePhone') }">

<input type="text" name="emailAddress" class="form-control" v-model="form.emailAddress" v-validate ="{ rules: { required: contactInfo} }" :class="{'input': true, 'is-danger': errors.has('emailAddress') }">

<input type="text" name="phoneNumber" class="form-control" v-model="form.phoneNumber" v-validate ="{ rules: { required: contactInfo} }" :class="{'input': true, 'is-danger': errors.has('phoneNumber') }">

JS Computed code

computed: {
    contactInfo () {
      if (this.form.phoneNumber || this.form.mobilePhone || this.form.emailAddress) {
        return false
      }
      else {
        return true
      }
    }
  }

Leave a comment