Skip to content

form-validation/form-validation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 

Repository files navigation

FormValidation

The best validation library for JavaScript.

FormValidation

Biggest collection of validators

40+ validators, 50+ plugins

  • Cover most various types of form field
  • Develop, reuse custom validator
  • Support sync and async validators
  • Plugin based architectue

Flexible

  • Customize icon
  • Customize error message
  • Customize error message location
  • Customize valid and invalid colors
  • Dynamic field
  • Enable, disable validators on the fly

Localization

  • Language packages for error message
  • Support custom message
  • Support custom validators
  • Switch between locales
  • Validate ID and VAT numbers in many countries

Declaring validation rules

  • Declarative mode
<form id="registrationForm">
    <input
        name="userName"
        data-fv-not-empty="true"
        data-fv-not-empty___message="The username is required"
        data-fv-string-length="true"
        data-fv-string-length___min="6"
        data-fv-string-length___message="The name must be more than 6 characters long"
    />
</form>
  • Programmatic mode
FormValidation.formValidation(
    document.getElementById('registrationForm'),
    {
        fields: {
            userName: {
                validators: {
                    notEmpty: {
                        message: 'The username is required',
                    },
                    stringLength: {
                        message: 'The name must be more than 6 characters long',
                        min: 6,                        
                    },
                },
            },
        },
    },
);

Integration with your stack

  • Support native form
  • Support popular CSS frameworks via plugins
  • Support popular JavaScript frameworks
  • Easy to integrate with a framework

Play nice with form libraries

  • Autocomplete
  • Color picker
  • Custom checkbox
  • Custom radio
  • Date picker
  • International telephone input
  • Mask input
  • Rich editor
  • Select
  • Star rating
  • Tag input
  • Time picker
  • Toggle
  • Wizard

and more!

Supported browsers

Support the latest version of

  • Chrome
  • Firefox
  • Safari
  • Opera
  • Edge
  • Internet Explorer 11

About

This project is developed by Nguyen Huu Phuoc. I love building products and sharing knowledge.

Be my friend on