Home

Awesome

vue-validator

form validator for vue 0.11

usage:

var Vue = require('vue')
var validator = require('vue-validator')
Vue.use(validator)

in template

<input type="text" v-model="name" v-valid="required,minLength:3,alpha">

means.. name is required, must be at least 3 character length and only alphabetic characters. If all this rules are satisfied input will get valid class otherwise invalid. Validator status is held in vm.validator. See demo.js for more examples of usage.

For custom elements you can specify model name in additional attribute model.

<xcomponent model="name" v-valid="required"></xcomponent>

v-valid options:

You can add additional filters to Vue.util.validators

validator data:

methods added to VM:

DEMO

http://xrado.github.io/vue-validator/

TODO

License

MIT

Copyright (c) 2014 Radovan Lozej