Easy Validator

With this you can easily validate your entries.

Usage

//add this to your attributes to your input fields

af-input    = add the class to your field

ev-obj-name = this will become the json object name 

ev-msg      = an alert message your user will see 

required    = if you want to make the field required...which means your user will have to fill in the info 

Examples


//example > simple
<input type="password" class="af-input" ev-obj-name="user_password">

//example > custom alert
<input type="text" class="af-input" required ev-obj-name="user_name" ev-msg="enter user name 123">


//You can use custom types: input, textarea, checkbox, select

use this attribute > ev-type="select"

//custom > dropdown list
<select class="af-input" required  ev-type="select" ev-msg="You need to select one"  ev-obj-name="user_selection_option">
	<option value="" >Please select one </option>
	<option value="saab">Saab </option>
	<option value="mercedes">Mercedes </option>
	<option value="audi">Audi </option>
</select>


Calling it in your javascript


$(document).on('click', '.Login_Btn', function(event) 
{
	event.preventDefault();

	//this the top contianer element where you fields are in
	var e0 = $(document).find('.LoginForm');

	//will return a json object with values that you can send to your server
	var check = e0.easyvalidator();

	if(check )
	{				
		//check variable will have your json object
	}
}); 



Easy Validator

*required

*


*




*




*




* I have a bike required
I have a car
I have a boat



*