Simple Custom Form Validation JavaScript Library – JSFormValidation

Category: Form , Javascript | November 17, 2015
Author: lindsaywatt
Views Total: 3,128
Official Page: Go to website
Last Update: November 17, 2015
License: MIT

Preview:

Simple Custom Form Validation JavaScript Library – JSFormValidation

Description:

A simple and fast JavaScript library that provides client side validation with custom error messages and validation rules for html forms.

Basic usage:

Put the JSFormValidation.js file into your html page.

<script src="FormValidation.js"></script>

Declare validation paramaters using data-validation attribute on the form elements.

  •  req
  • len:<min>-<max>
  • regex:<pattern_name>
  • match:<name_of_input_to_match>
  • radio:<shared_name_of_radio_buttons>
  • checkbox:<shared_name_of_checkboxes>:<min_checked>:<max_checked>
  • select
  • select-req
<input type="text" name="name" placeholder="Full Name" data-validation="req len:0-45 regex:name">

Initialize the JSFormValidation and we’re done.

FormValidation(document.getElementById("register-form"));

You Might Be Interested In:


Leave a Reply