UI Utilities > Validation


willvalidate 0.03


validation forms
  • javascript
  • vuejs
  • validate
  • form
last commit 5 years ago
8
Stargazers

Watchers
8
Open issues
0
190
Downloads

Last 30 days
5
Releases
5
28
Final Score

Quality
52
Popularity
1
Maintenance
34

willvalidate

Validation Forms

Available in awesome-vue
Available in npm

Setup

Install dependencies

npm install willvalidate --save

Into main.js vuejs (Single File Components)

import Vue from 'Vue'
import willvalidate from 'willvalidate'
Vue.use(willvalidate)

Usage

Ex: within methods

export default {
  methods:{
    sendForm()
    {
       this.willvalidate( document.querySelector("#form") ) ? console.log("ok") : console.log("error")
    }
  }
}

Or in script tag

<script src="./PATH/node_modules/willvalidate/dist/willvalidate.js"></script>

Use Attr html5 for validation

Ex: require, maxlength, minlength, type, pattern, min, max and others

Customize

# error class 
.has-danger{}

# set errorMessage | optional - if not informed will show default message
Ex: <input type="number" min="5" max="20" errorMessage="Preencha corretamente" required  />

Demo