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 yunity / karrot-frontend / src / places / components / PlaceEdit.vue View on Github external
archive (event) {
      Dialog.create({
        title: this.$t('STOREEDIT.DIALOGS.ARCHIVE.TITLE'),
        message: this.$t('STOREEDIT.DIALOGS.ARCHIVE.MESSAGE'),
        cancel: this.$t('BUTTON.CANCEL'),
        ok: this.$t('STOREEDIT.DIALOGS.ARCHIVE.CONFIRM'),
      })
        .onOk(() => this.$emit('save', { id: this.value.id, status: 'archived' }, event))
    },
  },
  validations: {
    edit: {
      name: {
        required,
        minLength: minLength(3),
        maxLength: maxLength(80),
        isUnique (value) {
          if (value === '') return true
          return !this.allPlaces
            .filter(e => e.id !== this.edit.id)
            .find(e => e.name === value)
        },
      },
    },
  },
}
github yunity / karrot-frontend / src / authuser / components / Signup.vue View on Github external
submit () {
      this.$v.user.$touch()
      if (!this.canSave || this.isPending) return
      this.$emit('submit', {
        userData: this.user,
        joinPlayground: this.joinPlayground,
      })
      this.$v.user.$reset()
    },
  },
  validations: {
    user: {
      displayName: {
        required,
        minLength: minLength(3),
        maxLength: maxLength(80),
      },
    },
  },
}
github luniehq / lunie / src / components / ActionModal / ModalPropose.vue View on Github external
validations() {
    return {
      title: {
        required,
        minLength: minLength(1),
        maxLength: maxLength(this.titleMaxLength),
        notBlank
      },
      description: {
        required,
        minLength: minLength(1),
        maxLength: maxLength(this.descriptionMaxLength),
        notBlank
      },
      type: {
        isValid
      },
      amount: {
        required: x => !!x && x !== `0`,
        decimal,
        between: between(SMALLEST, atoms(this.balance))
      }
    }
  },
  methods: {
github luniehq / lunie / app / src / renderer / components / staking / PageWelcome.vue View on Github external
}
    },
    resetFields () {
      this.$v.$reset()
      this.fields = {
        agreement: 'I understand the risks',
        repeatAgreement: ''
      }
    }
  },
  validations: {
    fields: {
      repeatAgreement: {
        required,
        minLength: minLength(22),
        maxLength: maxLength(22),
        sameAs: sameAs('agreement')
      }
    }
  }
}
github bytefury / crater / resources / assets / js / components / base / modal / ItemModal.vue View on Github external
}
  },
  validations: {
    formData: {
      name: {
        required,
        minLength: minLength(3)
      },
      price: {
        required,
        numeric,
        minValue: minValue(0.1),
        maxLength: maxLength(10)
      },
      description: {
        maxLength: maxLength(255)
      }
    }
  },
  computed: {
    ...mapGetters('currency', [
      'defaultCurrencyForInput'
    ]),
    price: {
      get: function () {
        return this.formData.price / 100
      },
      set: function (newValue) {
        this.formData.price = newValue * 100
      }
    },
    ...mapGetters('modal', [
github bytefury / crater / resources / assets / js / views / invoices / Item.vue View on Github external
validations () {
    return {
      item: {
        name: {
          required
        },
        quantity: {
          required,
          minValue: minValue(1),
          maxLength: maxLength(20)
        },
        price: {
          required,
          minValue: minValue(1),
          maxLength: maxLength(20)
        },
        discount_val: {
          between: between(0, this.maxDiscount)
        },
        description: {
          maxLength: maxLength(255)
        }
      }
    }
  },
  created () {
github jhipster / jhipster-sample-app-vuejs / src / main / webapp / app / account / settings / settings.component.ts View on Github external
settingsAccount: {
    firstName: {
      required,
      minLength: minLength(1),
      maxLength: maxLength(50)
    },
    lastName: {
      required,
      minLength: minLength(1),
      maxLength: maxLength(50)
    },
    email: {
      required,
      email,
      minLength: minLength(5),
      maxLength: maxLength(254)
    }
  }
};

@Component({
  validations
})
export default class Settings extends Vue {
  public success: string = null;
  public error: string = null;
  public errorEmailExists: string = null;
  public languages: any = this.$store.getters.languages || [];

  public save(): void {
    this.error = null;
    this.errorEmailExists = null;
github bytefury / crater / resources / assets / js / views / expenses / Create.vue View on Github external
previewReceipt: null,
      fileSendUrl: '/api/expenses'
    }
  },
  validations: {
    category: {
      required
    },
    formData: {
      expense_date: {
        required
      },
      amount: {
        required,
        minValue: minValue(0.1),
        maxLength: maxLength(20)
      },
      notes: {
        maxLength: maxLength(255)
      }
    }
  },
  computed: {
    ...mapGetters('currency', [
      'defaultCurrencyForInput'
    ]),
    amount: {
      get: function () {
        return this.formData.amount / 100
      },
      set: function (newValue) {
        this.formData.amount = newValue * 100
github jhipster / jhipster-vuejs / generators / client / templates / vue / src / main / webapp / app / components / account / register / Register.component.ts View on Github external
errorEmailExists: undefined,
      errorUserExists: undefined,
      registerAccount: {
        login: undefined,
        email: undefined,
        password: undefined
      },
      success: false
    };
  },
  validations: {
    registerAccount: {
      login: {
        required,
        minLength: minLength(1),
        maxLength: maxLength(50),
        pattern: loginPattern
      },
      email: {
        required,
        minLength: minLength(5),
        maxLength: maxLength(254),
        email
      },
      password: {
        required,
        minLength: minLength(4),
        maxLength: maxLength(254)
      }
    },
    confirmPassword: {
      required,