JavaScript is the only game in town if you want to validate user input on the client-side. However, often our validation scripts are ad-hoc and coded every time we need to validate a form. And this works ok as long as we are doing simple validations like length and null checks. But things start to go crazy as we move into advanced stuff like checking for input in a particular format, or requiring some specific number of decimals etc.
I have seen that the commonly accepted solution in such a scenario is to write functions for each different kind of validation, and in fact this is what I used to do as well. But I have been working on a pure java based reporting tool for some time now, and for that I required a robust and reliable validation framework.
I’m not a JavaScript guru, and I realised that most other programmers using my framework will not be Gurus either, therefore we needed to keep things as simple as possible. And thus was born Cerberus.
Cerberus is a regular expression based client-side validation framework. We will be building it together through this tutorial.