This file explain how to use my form-validator script. It's aim is to be fast and simple to implement yet flexible enough to handle most forms. I think I have been able to reach those goals with this version. You should realise that this is my final release, some new ideas to update this validator are being written as we read and will not be 100% backwards compatible. Upgrading to the new version should still be relatively painless however.
Implementing the form-validator I have created is fairly easy and doesn't require a lot of javascript knowledge, some knowledge of regular expression is required to modify the default behavior, ample help-files can be found on the net. Simply right-click and save the script as a text file. Then link it into your page with a simple line of code in the <head> of your page like so: <script type="text/javascript" src="validator.js"></script>.
The script, off course, comes with the default examples as demonstrated on this page, you should overwrite the default settings to reflect your own form. The exact information may be found in the script files itself, but in short summary it comes down to three arrays that you should overwrite yourself.
validators, which contains the regular expressions and/or functions to validate each field that needs it.matchfields, which maps password fields so that two will automatically be compared, a functionality often required in forms.- And last is the array
messages, which will contain the error messages for your form-fields. As is also described in the script file, \1 will be replaced by the name of the form-field if you should desire such.
Last, but certainly not least, you should set your form up for validation by adding an event to it. I will not discuss the more advanced ways of doing so, even though those are desirable, I did not intend to teach people the proper way of adding events in this paper. The most simple way of adding validation will be to add the onsubmit event in-line, like so: <form action="yourchoice" onsubmit="return validate(this);">.