How to use the vuelidate/lib/validators/maxLength 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 vuefront / vuefront / src / components / elements / account / password.vue View on Github external
confirmPassword: null
      }
    };
  },
  mixins: [validationMixin],
  validations: {
    form: {
      password: {
        required,
        minLength: minLength(4),
        maxLength: maxLength(20)
      },
      confirmPassword: {
        required,
        minLength: minLength(4),
        maxLength: maxLength(20),
        sameAsPassword: sameAs("password")
      }
    }
  },
  computed: {
    ...mapGetters({
      error: "vuefront/error"
    })
  },
  methods: {
    async onSubmit() {
      this.$v.$touch();

      if (!this.$v.form.$invalid) {
        await this.$store.dispatch("common/customer/editPassword", {
          password: this.form.password
github vuefront / vuefront / lib / components / organisms / review-form / review-form.vue View on Github external
author: "",
      rating: 0,
      review: ""
    };
  },
  mixins: [validationMixin],
  validations: {
    rating: {
      required,
      minValue: minValue(1),
      maxValue: maxValue(5)
    },
    author: {
      required,
      minLength: minLength(1),
      maxLength: maxLength(32)
    },
    review: {
      required,
      minLength: minLength(25),
      maxLength: maxLength(1000)
    }
  },
  methods: {
    onSubmit(e) {
      this.$v.$touch();

      if (!this.$v.$invalid) {
        this.$emit("submit", {
          content: this.review,
          author: this.author,
          rating: this.rating
github vuefront / vuefront / src / components / elements / common / contact / form.vue View on Github external
mixins: [validationMixin],
  validations: {
    form: {
      name: {
        required,
        minLength: minLength(3),
        maxLength: maxLength(32)
      },
      email: {
        required,
        email
      },
      message: {
        required,
        minLength: minLength(10),
        maxLength: maxLength(3000)
      }
    }
  },
  methods: {
    async onSubmit(e) {
      this.$v.$touch();

      if (!this.$v.form.$invalid) {
        await this.$store.dispatch("common/contact/send", this.form);
        if (!this.error) {
          this.$store.commit(
            "notification/add",
            this.$t("elements.common.contact.successText")
          );

          e.preventDefault();
github vuefront / vuefront / src / components / elements / account / register.vue View on Github external
minLength: minLength(1),
        maxLength: maxLength(32)
      },
      email: {
        required,
        email
      },
      password: {
        required,
        minLength: minLength(4),
        maxLength: maxLength(20)
      },
      confirmPassword: {
        required,
        minLength: minLength(4),
        maxLength: maxLength(20),
        sameAsPassword: sameAs("password")
      }
    }
  },
  computed: {
    ...mapGetters({
      error: "vuefront/error"
    })
  },
  methods: {
    async onSubmit() {
      this.$v.$touch();

      if (!this.$v.form.$invalid) {
        await this.$store.dispatch("common/customer/register", {
          firstName: this.form.firstName,
github vuefront / vuefront / src / components / templates / account / editAddress / editAddress.vue View on Github external
minLength: minLength(1),
          maxLength: maxLength(32)
        },
        lastName: {
          required,
          minLength: minLength(1),
          maxLength: maxLength(32)
        },
        company: {
          minLength: minLength(1),
          maxLength: maxLength(32)
        },
        address1: {
          required,
          minLength: minLength(3),
          maxLength: maxLength(128)
        },
        address2: {
          minLength: minLength(3),
          maxLength: maxLength(128)
        },
        city: {
          required,
          minLength: minLength(2),
          maxLength: maxLength(128)
        },
        countryId: {
          required
        },
        zipcode: {
          required,
          minLength: minLength(2),
github vuefront / vuefront / src / components / elements / account / editAddress.vue View on Github external
required
        }
      };
    }

    return {
      form: {
        firstName: {
          required,
          minLength: minLength(1),
          maxLength: maxLength(32)
        },
        lastName: {
          required,
          minLength: minLength(1),
          maxLength: maxLength(32)
        },
        company: {
          minLength: minLength(1),
          maxLength: maxLength(32)
        },
        address1: {
          required,
          minLength: minLength(3),
          maxLength: maxLength(128)
        },
        address2: {
          minLength: minLength(3),
          maxLength: maxLength(128)
        },
        city: {
          required,
github vuefront / vuefront / src / components / elements / account / register.vue View on Github external
confirmPassword: null
      }
    };
  },
  mixins: [validationMixin],
  validations: {
    form: {
      firstName: {
        required,
        minLength: minLength(1),
        maxLength: maxLength(32)
      },
      lastName: {
        required,
        minLength: minLength(1),
        maxLength: maxLength(32)
      },
      email: {
        required,
        email
      },
      password: {
        required,
        minLength: minLength(4),
        maxLength: maxLength(20)
      },
      confirmPassword: {
        required,
        minLength: minLength(4),
        maxLength: maxLength(20),
        sameAsPassword: sameAs("password")
      }
github vuefront / vuefront / lib / components / organisms / address-create-form / address-create-form.vue View on Github external
let fields = {};

    if (!isEmpty(this.zones) && this.zones.content.length > 0) {
      fields = {
        ...fields,
        zoneId: {
          required
        }
      };
    }
    return {
      form: {
        firstName: {
          required,
          minLength: minLength(1),
          maxLength: maxLength(32)
        },
        lastName: {
          required,
          minLength: minLength(1),
          maxLength: maxLength(32)
        },
        company: {
          minLength: minLength(1),
          maxLength: maxLength(32)
        },
        address1: {
          required,
          minLength: minLength(3),
          maxLength: maxLength(128)
        },
        address2: {
github vuefront / vuefront / src / components / elements / account / createAddress.vue View on Github external
minLength: minLength(3),
          maxLength: maxLength(128)
        },
        address2: {
          minLength: minLength(3),
          maxLength: maxLength(128)
        },
        city: {
          required,
          minLength: minLength(2),
          maxLength: maxLength(128)
        },
        zipcode: {
          required,
          minLength: minLength(2),
          maxLength: maxLength(10)
        },
        countryId: {
          required
        },
        ...fields
      }
    };
  },
  computed: {
github vuefront / vuefront / src / components / templates / account / editAddress / editAddress.vue View on Github external
if (this.zones.content.length > 0) {
      fields = {
        ...fields,
        zoneId: {
          required
        }
      };
    }

    return {
      form: {
        firstName: {
          required,
          minLength: minLength(1),
          maxLength: maxLength(32)
        },
        lastName: {
          required,
          minLength: minLength(1),
          maxLength: maxLength(32)
        },
        company: {
          minLength: minLength(1),
          maxLength: maxLength(32)
        },
        address1: {
          required,
          minLength: minLength(3),
          maxLength: maxLength(128)
        },
        address2: {