How to use the vuelidate/lib/validators.minLength 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 DefinitelyTyped / DefinitelyTyped / types / vuelidate / vuelidate-tests.ts View on Github external
required,
            integer
        },
        coolFactor: {
            required,
            decimal
        },
        flatA: { required },
        flatB: { required },
        forGroup: {
            nested: { required }
        },
        validationGroup: ['age', 'coolFactor', 'flatA', 'flatB', 'forGroup.nested'],
        people: {
            required,
            minLength: minLength(3),
            $each: {
                name: {
                    required,
                    minLength: minLength(2)
                }
            }
        },
        username: {
            required,
            isUnique(value: string) {
                // standalone validator ideally should not assume a field is required
                if (value === '') return true

                // simulate async call, fail for all logins with even length
                return new Promise((resolve, reject) => {
                    setTimeout(() => {
github MillerRen / vue-boilerplate / src / components / LoginForm.vue View on Github external
},
    submit () {
      this.$v.$touch()
      if (this.$v.$invalid) return
      this.onSubmit(this.account)
    }
  },
  validations: {
    account: {
      email: {
        required,
        email
      },
      password: {
        required,
        minLength: minLength(6)
      }
    }
  }
}
github chatwoot / chatwoot / app / javascript / dashboard / routes / dashboard / settings / canned / AddCanned.vue View on Github external
showLoading: false,
        message: '',
      },
      agentTypeList: this.$t('CANNED_MGMT.AGENT_TYPES'),
      show: true,
    };
  },
  computed: {
    headerImage() {
      return cannedImg;
    },
  },
  validations: {
    shortCode: {
      required,
      minLength: minLength(2),
    },
    content: {
      required,
    },
    agentType: {
      required,
    },
  },

  methods: {
    setPageName({ name }) {
      this.$v.agentType.$touch();
      this.agentType = name;
    },
    showAlert() {
      bus.$emit('newToastMessage', this.addCanned.message);
github chatwoot / chatwoot / app / javascript / dashboard / routes / dashboard / settings / agents / AddAgent.vue View on Github external
agentTypeList: this.$t('AGENT_MGMT.AGENT_TYPES'),
      show: true,
    };
  },
  computed: {
    headerImage() {
      return agentImg;
    },
    ...mapGetters({
      uiFlags: 'agents/getUIFlags',
    }),
  },
  validations: {
    agentName: {
      required,
      minLength: minLength(4),
    },
    agentEmail: {
      required,
      email,
    },
    agentType: {
      required,
    },
  },

  methods: {
    setPageName({ name }) {
      this.$v.agentType.$touch();
      this.agentType = name;
    },
    showAlert(message) {
github luniehq / lunie / app / src / renderer / components / common / TmSessionAccountDelete.vue View on Github external
validations: () => ({
    fields: {
      deletionPassword: { required, minLength: minLength(10) },
      deletionWarning: { required }
    }
  })
}
github pixel-point / kube-forwarder / src / renderer / components / shared / service / ServiceForm.vue View on Github external
serviceId: { type: String, default: null },
    initialAttributes: { type: Object, default: () => ({}) }
  },
  validations: {
    attributes: {
      clusterId: { required },
      alias: {},
      namespace: { required },
      workloadType: {
        required,
        oneOf: (value) => Object.values(resourceKinds).includes(value)
      },
      workloadName: { required },
      forwards: {
        required,
        minLength: minLength(1),
        $each: {
          localPort: { required, integer, between: between(0, 65535) },
          remotePort: { required, integer, between: between(0, 65535) }
        }
      }
    }
  },
  data() {
    return {
      error: null,
      attributes: {
        ...this.getEmptyAttributes(),
        clusterId: this.$route.params.clusterId,
        ...cloneDeep(this.initialAttributes)
      },
      namespaces: {
github vuelidate / vuelidate / docs / partials / examples / ExampleParams.vue View on Github external
import { required, minLength } from 'vuelidate/lib/validators'

export default {
  data() {
    return {
      form: {
        userName: '',
        password: ''
      }
    }
  },
  validations: {
    form: {
      userName: {
        required,
        minLength: minLength(5)
      },
      password: {
        required,
        minLength: minLength(8)
      }
    }
  }
}
github bytefury / crater / resources / assets / js / components / base / modal / ItemModal.vue View on Github external
{ name: 'lb', value: 'lb' },
        { name: 'mg', value: 'mg' }
      ],
      formData: {
        name: null,
        price: null,
        description: null,
        unit: null
      }
    }
  },
  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'
    ]),
github gardener / dashboard / frontend / src / dialogs / SecretDialogAlicloud.vue View on Github external
validators () {
      const validators = {
        accessKeyId: {
          required,
          minLength: minLength(16),
          maxLength: maxLength(128)
        },
        accessKeySecret: {
          required,
          minLength: minLength(30)
        }
      }
      return validators
    },
    isCreateMode () {
github vuelidate / vuelidate / docs / partials / examples / ExampleEachArray.vue View on Github external
name: 'John'
        },
        {
          name: ''
        }
      ]
    }
  },
  validations: {
    people: {
      required,
      minLength: minLength(3),
      $each: {
        name: {
          required,
          minLength: minLength(2)
        }
      }
    }
  }
}