ang-validator
v0.1.2
Published
The jQuery form validation plugin makes easier to apply validations on html form field. It has many options for different types of validations like url, email, numeric type, file validation etc.
Downloads
2
Maintainers
Readme
ANG Validator - jQuery form validation plugin
The jQuery form validation plugin makes easier to apply validations on html form field. It has many options for different types of validations like url, email, numeric type, file validation etc.
It provides easy way to apply custom validation options like inline css.
Getting Started
Include required files in head tag :
<script src="http://code.jquery.com/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="angvalidate-1.0.min.js" ></script>
<link rel="Stylesheet" type="text/css" href="angvalidate.css" />
Initiate plugin using following code :
<script type="text/javascript">
$(document).ready(function(){
$('.required').angvalidate();
});
</script>
You can initialise plugin to override default settings :
$('.required').angvalidate({
error_message :'This field is required.', //default error message
error_message_ext :'File type is not valid.', //default file type error message
error_message_size :'File size is not accepted.', //default file size error message
error_msg_class :'error_msg', //default error message class
error_input_class :'error_input', //default error input class
success_input_class :'success_input', //default success input class
allowed_max_size :1000, //default maximum file size in KB
allowed_extensions :"jpg,png" //default allowed file extensions
});
Note: Here ".required" is the element selector you can use your own
Use html code as below :
<input type="text" name="sample_text" class="required" >
You can apply custom options like inline css as below:
If you want to display error message in perticuar element :-
<input type="text" name="sample_txt" class="required" ang-options="display-id:my_div">
<div id="my_div"></div>
If you want to display custom error message :-
<input type="text" name="sample_txt" class="required" ang-options="msg:This is my custom error message;">
If you want to apply email validation :-
<input type="text" name="sample_txt" class="required" ang-options="email:true">
If you want to call custom function :-
<input type="text" name="sample_txt" class="required" ang-options="custom-function:my_func;">
If you want to apply file validaton with many options :-
<input type="file" name="sample_file" class="required" ang-options="allowed-ext:jpg,png;allowed-size:29000;msg:Please Select File;msg-ext:Please Select jpg or png File;msg-size:file size exceed">