Let's you perform form validation with just one line of code.
Download our library & include it in your project
<script src="dist/validation.js"></script>
<input type="text" class="form-control" id="name" data-valtype="put validation type here" >
Replace the data-valtype attribute value by one of the validation types mentioned below
Type | data-valtype |
---|---|
Names | name |
Email Addresses | |
Numbers | number |
Date | date |
Password | password |
Contact Number | contact |
Month | month |
Credit Card | creditcard |
Or you can create your own validator by passing on your own regular expression to data-valtype surrounded by |. For example
<input type="text" class="form-control" id="contact" data-valtype="|^[0-9]{1,2}(-|\/)[0-9]{1,2}(-|\/)([0-9]{2}|[0-9]{4})$|" >
The above code performs date validation.
//Do whatever you want to do when validation is successful
function validationCorrectCase(field){
$( field ).css( "border-color", "green" );
}
//Do whatever you want to do when validation is unsuccessful
function validationIncorrectCase(field){
$( field ).css( "border-color", "red" );
}
Modify this part in validation.js to modify the behavior on successful and unsuccessful validation.
You are done. Deploy your amazing web application.
It is the ultimate luxury to combine passion and contribution. It's also a very clear path to happiness. -Sheryl Sandberg
- Fork the repository on GitHub
- Clone the project into your own machine
- Work on the forked project
- Make your changes and additions
- Add changes to README.md if needed
- Commit changes to your own branch
- Push your work back up to your fork
- Submit a Pull request so that we can review your changes
Follow us on facebook.
Thank you :)