How to use the vuelidate/lib/validators.requiredIf function in vuelidate

To help you get started, we’ve selected a few vuelidate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SUSE / Portus / app / assets / javascripts / modules / teams / components / new-form.vue View on Github external
this.toggleForm();
          this.$v.$reset();
          set(this, 'team', {
            name: '',
          });

          this.$bus.$emit('teamCreated', team);
          this.$alert.$show(`Team '${team.name}' was created successfully`);
        }).catch(handleHttpResponseError);
      },
    },

    validations: {
      team: {
        owner_id: {
          required: requiredIf(function () {
            return window.isAdmin;
          }),
        },

        name: {
          required,
          available(value) {
            clearTimeout(this.timeout.name);

            // required already taking care of this
            if (value === '') {
              return true;
            }

            return new Promise((resolve) => {
              const searchTeam = () => {
github luniehq / lunie / src / components / ActionModal / ActionFees.vue View on Github external
validations() {
    return {
      gasPrice: {
        required: requiredIf(
          () => this.step === feeStep && this.session.experimentalMode
        ),
        // we don't use SMALLEST as min gas price because it can be a fraction of uatom
        // min is 0 because we support sending 0 fees
        between: between(0, atoms(this.balance))
      },
      invoiceTotal: {
        between: between(0, atoms(this.balance))
      }
    }
  }
}
github luniehq / lunie / src / components / ActionModal / DevTransaction.vue View on Github external
validations() {
    return {
      gasPrice: {
        required: requiredIf(
          () => this.step === feeStep && this.session.experimentalMode
        ),
        // we don't use SMALLEST as min gas price because it can be a fraction of uatom
        // min is 0 because we support sending 0 fees
        between: between(0, atoms(this.balance))
      }
    }
  }
}
github luniehq / lunie / src / components / ActionModal / TransactionModal.vue View on Github external
validations() {
    return {
      password: {
        required: requiredIf(
          () =>
            this.selectedSignMethod === signWithLocalKeystore &&
            this.step === signStep
        )
      },
      gasPrice: {
        required: requiredIf(
          () => this.step === feeStep && this.session.experimentalMode
        ),
        // we don't use SMALLEST as min gas price because it can be a fraction of uatom
        // min is 0 because we support sending 0 fees
        between: between(0, atoms(this.balance))
      },
      invoiceTotal: {
        between: between(0, atoms(this.balance))
      }
github gardener / dashboard / frontend / src / components / NewShoot / NewShootInfrastructureDetails.vue View on Github external
required: 'Floating Pools required'
  },
  loadBalancerProviderName: {
    required: 'Load Balancer Providers required'
  }
}

const validations = {
  secret: {
    required
  },
  region: {
    required
  },
  floatingPoolName: {
    required: requiredIf(function () {
      return this.infrastructureKind === 'openstack'
    })
  },
  loadBalancerProviderName: {
    required: requiredIf(function () {
      return this.infrastructureKind === 'openstack'
    })
  }
}

export default {
  name: 'new-shoot-infrastructure',
  components: {
    CloudProfile,
    SecretDialogWrapper
  },
github bytefury / crater / resources / assets / js / views / wizard / UserProfile.vue View on Github external
validations: {
    profileData: {
      name: {
        required,
        minLength: minLength(3)
      },
      email: {
        email,
        required
      },
      password: {
        required,
        minLength: minLength(5)
      },
      confirm_password: {
        required: requiredIf('isRequired'),
        sameAsPassword: sameAs('password')
      }
    }
  },
  computed: {
    isRequired () {
      if (this.profileData.password === null || this.profileData.password === undefined || this.profileData.password === '') {
        return false
      }
      return true
    }
  },
  methods: {
    ...mapActions('userProfile', [
      'uploadOnboardAvatar'
    ]),
github gardener / dashboard / frontend / src / components / ShootHibernation / HibernationScheduleEvent.vue View on Github external
}

export default {
  name: 'hibernation-schedule-event',
  props: {
    scheduleEvent: {
      type: Object,
      required: true
    }
  },
  validations: {
    selectedDays: {
      required
    },
    hibernateTime: {
      required: requiredIf(function () {
        return !this.wakeUpTime
      })
    },
    wakeUpTime: {
      required: requiredIf(function () {
        return !this.hibernateTime
      })
    },
    selectedTimezone: {
      required
    }
  },
  computed: {
    ...mapState([
      'localTimezone'
    ]),
github bytefury / crater / resources / assets / js / views / settings / UserProfile.vue View on Github external
}
  },
  validations: {
    formData: {
      name: {
        required
      },
      email: {
        required,
        email
      },
      password: {
        minLength: minLength(5)
      },
      confirm_password: {
        required: requiredIf('isRequired'),
        sameAsPassword: sameAs('password')
      }
    }
  },
  computed: {
    isRequired () {
      if (this.formData.password === null || this.formData.password === undefined || this.formData.password === '') {
        return false
      }
      return true
    }
  },
  mounted () {
    this.setInitialData()
  },
  methods: {
github sogehige / sogeBot / src / panel / views / managers / events / edit.vue View on Github external
return object
    },
    validations: {
      event: {
        givenName: {
          required,
        },
        definitions: {
          fadeOutXCommands: {
            required: requiredIf(function (model) {
              return typeof model.fadeOutXCommands !== 'undefined'
            }),
            minValue: minValue(0)
          },
          fadeOutInterval: {
            required: requiredIf(function (model) {
              return typeof model.fadeOutInterval !== 'undefined'
            }),
            minValue: minValue(0)
          },
          runEveryXCommands: {
            required: requiredIf(function (model) {
              return typeof model.runEveryXCommands !== 'undefined'
            }),
            minValue: minValue(0)
          },
          runEveryXKeywords: {
            required: requiredIf(function (model) {
              return typeof model.runEveryXKeywords !== 'undefined'
            }),
            minValue: minValue(0)
          },