Form Validator

These functions have dependency on jQuery



With these user-friendly functions you can easily valid your form for different things

With this function you can easily check to see if your input field is empty or not

Usage
//Syntax 
frm.IsEmpty(value) 

//Example
$('.btn_Validate_IsEmpty').click(function(e)
{
 //To clear all old alerts
 bs.ClearError();
 
 //Get the field value
 var d = $('.field_IsEmpty').val();
 
 // Validate field
 if(frm.IsEmpty(d))
 {
  //Show alert
  bs.ShowError ("Please enter text",$('.field_IsEmpty'))
 }
})


Try clicking the Validate Button before entering any data



With this function you can easily check to see if your input field is alpha numeric or not

Usage
//Syntax 
frm.IsAlphaNumeric(value) 

//Example
$('.btn_Validate_IsAlphaNumeric').click(function(e)
{
 //To clear all old alerts
 bs.ClearError();
 
 //Get the field value
 var d = $('.field_IsAlphaNumeric').val();
 
 // Validate field
 if(frm.IsAlphaNumeric(d))
 {
  //Show alert
  bs.ShowError ("Please enter Alpha Numeric value ",$('.field_IsAlphaNumeric'))
 }
})


Try clicking the Validate Button before entering any data



With this function you can easily check to see if your input field contains any spaces or not

Usage
//Syntax 
frm.IsNoSpaces(value) 

//Example
$('.btn_Validate_IsNoSpaces').click(function(e)
{
 //To clear all old alerts
 bs.ClearError();
 
 //Get the field value
 var d = $('.field_IsNoSpaces').val();
 
 // Validate field
 if(frm.IsNoSpaces(d))
 {
  //Show alert
  bs.ShowError ("Please enter value with no spaces ",$('.field_IsNoSpaces'))
 }
})


Try clicking the Validate Button before entering any data



With this function you can easily check to see if the email address is vaild or not

Usage
//Syntax 
frm.IsEmail(value) 

//Example
$('.btn_Validate_IsEmail').click(function(e)
{
 //To clear all old alerts
 bs.ClearError();
 
 //Get the field value
 var d = $('.field_IsEmail').val();
 
 // Validate field
 if(frm.IsEmail(d))
 {
  //Show alert
  bs.ShowError ("Invaid Email ",$('.field_IsEmail'))
 }
})


Try clicking the Validate Button before entering any data



With this function you can easily check to see if the URL address is vaild or not

Usage
//Syntax 
frm.IsURL(value) 

//Example
$('.btn_Validate_IsURL').click(function(e)
{
 //To clear all old alerts
 bs.ClearError();
 
 //Get the field value
 var d = $('.field_IsURLl').val();
 
 // Validate field
 if(frm.IsURL(d))
 {
  //Show alert
  bs.ShowError ("Invalid URL ",$('.field_IsURL'))
 }
})


Valid URL includes the following:

- http:// or https://

- sitename

- site extension (at least 2 characters long)

Valid URL will loook like: http://awesomefunctions.com

Try clicking the Validate Button before entering any data



With this function you can easily check to see if input field contains number value or not

Usage
//Syntax 
frm.IsNumber(value) 

//Example
$('.btn_Validate_IsNumber').click(function(e)
{
 //To clear all old alerts
 bs.ClearError();
 
 //Get the field value
 var d = $('.field_IsNumber').val();
 
 // Validate field
 if(frm.IsNumber(d))
 {
  //Show alert
  bs.ShowError ("Number value only ",$('.field_IsNumber'))
 }
})


Try clicking the Validate Button before entering any data



With this function you can easily check to see if input field value is between 2 numbers or not

Usage
//Syntax 
frm.IsBetweenNumber(value, 'startingvalue,endingvalue') 

//Example
$('.btn_Validate_IsBetweenNumberr').click(function(e)
{
 //To clear all old alerts
 bs.ClearError();
 
 //Get the field value
 var d = $('.field_IsBetweenNumber').val();
 
 // Validate field
 if(frm.IsBetweenNumber(d, '2,5'))
 {
  //Show alert
  bs.ShowError ("Number has to be between 2 and 5 ",$('.field_IsBetweenNumber'))
 }
})


Try clicking the Validate Button before entering any data



With this function you can easily check to see if input field value length is equal your allowed number or not

Usage
//Syntax 
frm.IsLength(value, Length) 

//Example
$('.btn_Validate_IsLength').click(function(e)
{
 //To clear all old alerts
 bs.ClearError();
 
 //Get the field value
 var d = $('.field_IsLength').val();
 
 // Validate field
 if(frm.IsLength(d, 6))
 {
  //Show alert
  bs.ShowError ("Has to be 6 characters ",$('.field_IsLength'))
 }
})


Try clicking the Validate Button before entering any data



With this function you can easily check to see if input field min value length is equals to your allowed number or not

Usage
//Syntax 
frm.IsMinLength(value, MinLength) 

//Example
$('.btn_Validate_IsMinLength').click(function(e)
{
 //To clear all old alerts
 bs.ClearError();
 
 //Get the field value
 var d = $('.field_IsMinLength').val();
 
 // Validate field
 if(frm.IsMinLength(d,5))
 {
  //Show alert
  bs.ShowError ("Has to be at leaset 5 characters long ",$('.field_IsMinLength'))
 }
})


Try clicking the Validate Button before entering any data



With this function you can easily check to see if input field max value length is equals to your allowed number or not

Usage
//Syntax 
frm.IsMaxLength(value, MaxLength) 

//Example
$('.btn_Validate_IsMaxLength').click(function(e)
{
 //To clear all old alerts
 bs.ClearError();
 
 //Get the field value
 var d = $('.field_IsMaxLength').val();
 
 // Validate field
 if(frm.IsMaxLength(d,5))
 {
  //Show alert
  bs.ShowError ("Max of 8 characters long ",$('.field_IsMaxLength'))
 }
})


Try clicking the Validate Button before entering any data



With this function you can easily check to see if input field value length is between your allowed length or not

Usage
//Syntax 
frm.IsRangeLength(value, 'StartLen, EndLen') 

//Example
$('.btn_Validate_IsRangeLength').click(function(e)
{
 //To clear all old alerts
 bs.ClearError();
 
 //Get the field value
 var d = $('.field_IsRangeLength').val();
 
 // Validate field
 if(frm.IsRangeLength(d,'2,5'))
 {
  //Show alert
  bs.ShowError ("Allowed characters length is between 2 to 5  ",$('.field_IsRangeLength'))
 }
})


Try clicking the Validate Button before entering any data



With this function you can easily check to see if value A matchs value B or not

Usage
//Syntax 
frm.IsEqualTo(value,EqualTo) 

//Example
$('.btn_Validate_IsEqualTo').click(function(e)
{
 //To clear all old alerts
 bs.ClearError();
 
 //Get the field value
 var d = $('.field_IsEqualTo').val();
 
 // Validate field
 if(frm.IsEqualTo(d,'awesomefunctions'))
 {
  //Show alert
  bs.ShowError ("Your input doesn't match. It should say: awesomefunctions",$('.field_IsRangeLength'))
 }
})


Try clicking the Validate Button before entering any data



With this function you can easily check to see if the data is in json format or not. It will return true if your data is in json format. Otherwiser it will return false.

Usage
//Syntax 
frm.IsJSON(DataValue) 

//Example 1
var json_check = frm.IsJSON("I love awesome functions");
console.log(json_check); // false



//Example 2
var data = {site:"http://awesomefunctions.com",user: "codewithmark"};

var json_check = frm.IsJSON(data);

console.log(json_check); // true