Form Helper JavaScript script

About the Form Helper Script

This Form Helper script is a JavaScript script meant to help validate data in web forms. It performs two functions. First, it checks a web form field against a developer defined list of checks for valid data. For convenience, common requirements for different field types are built right in. The second function is to give an all clear  if and only if all fields contain valid data.

A web page with a warning pop-up and some error text, displayed when the field data failed to pass the form helper's test.
The results of bad input given to the form helper

This code should be fairly modular. First, after the form handler is set up, it only needs to be run, and pass back a positive or negative for validation results. This way, form submission is handled separately. Second, I wrote this code in plain JavaScript, so it can be used with a variety of libraries and environments, though I’ve only used it with jQuery.

Lastly, this code has been very thoroughly tested with Jasmine.js. Jasmine is a JavaScript library meant to test JavaScript code. I wrote a multitude of test functions to test each filter, and to make sure each component works well together. I am fairly confident that this code as written is sturdy.  Why I bring it up is because I decided to go out of my way to use Jasmine. I wanted to learn more about programmatically testing code, so I decided to use Jasmine so that I could learn more about testing.

Code Availability

First, the plain source code is available here on GitHub. However, if you want to see a live example, then there is a live version available over here on

Leave a Reply