Grab the script here, and then use this html file as your resource for implementation.
errorClass
This lets you choose the class name that will be used when the script creates the span tag to encapsulate the error. Use this to let you apply a class you already currently have residing in your stylesheet, or to let you set up a new one.
dropdownDefault
Use this varialbe to determine what the default value is for a drop down, this is useful in cases where you want to make a drop down menu required, the script will use this value to determine which value is the default and then use this to check the currently selected value against.
dropdownOther
This is similar ot drop down default except that it is setting the default value for the drop down item which allows for an entry of "other". So if a user is select other from a drop down menu or a radio button group this value will ensure that the associated text box is completed.
alternate
This setting allows for different methods of error reporting. Currently the default of blank will display messages using the span creation method, however you may set this value to 1 and it will change from span to drawing a single pixel red border around the invalid form element (for textboxes only).
alterrorField
Allows you to set a class to be used in alternate 1 setting, for field and select elements only.
alterrorGroup
Allows you to set a class to be used in alternate 1 setting, for checkbox and radio button elements only. This class actually gets applied to the first label within the group and not the element directly. The reason behind this is twofold, a) firefox will have a hard time display any border styles and b) the error is actually for the entire group and not on a single element.
cbradioClass
If you are using a seperate class for radio buttons and check boxes, for instance to ensure that borders do not appear around them in IE, then please enter it here, otherwise you will notice any overriding input style taking over your radio/check boxes in terms of border style used.
<label for="name" id="forname"></label>
What this does is take the regular id of the input item and preceeds it with the word 'for'. This allows for the display of error messages inline with the page, essentially the javascript creates a span element within the label element. If you take a look at the sample CSS provided in the eample form you will not that the label tags all have position:relative set. This is a great help when you start styling your form and want to modify the position of the span tags that are created within each label.
title="required"
This marks the field as being a required element, this field accepts any type of input as long as there is atleast one character. When using this for a select menu you may want to include an error message within the title attribute since the alt attribute does not exist for select elements. This can be achieved by using the following syntax title="required|Please Select an item". Just be careful when entering an error message that your message does not contain any of the words you would use as a validation call, ie: postal, email, etc...
title="postal"
This checks the field has a properly formatted north american postal address, ie: 90210 or 1A1 A1A. You can modify the values it allows by changing the regular expression within the checkPostal function inside the js file. You can also pass a country code if you wish to change the validation type, currently it supports passing UK only by using the following syntax title="postal(UK)".
title="email"
This performs a check that the field is a properly formatted email address. Thast means a string followed by the @ symbol followed by a string, a . and then atleast 2 characters
title="phone"
This performs a check to ensure the string uses a properly formatted north american phone number, ie: (XXX) XXX-XXXX. Again if you wish to modify this you may change the regular expression with the validate_phone function. You can also pass a country code if you wish to change the validation type, currently it supports passing UK only by using the following syntax title="phone(UK)".
title="group"
This is useful for groups of radio buttons or even checkboxes where atleast one item must be selected. This means that adding this validation to a group of items will automatically make them required. Also note that the title attribute must be applied to ALL group items, not just one. It is useful to note however that you only need to place the alt attribute in the first item in the collection.
title="match_X"
This validation will ensure that two fields contain matching values. You would denote the two fields you wish to match by replacing the x with an appropriate letter or number, as long as they match on both fields. SO for instance you could have two match_a's and two match_b's on one page that would allow for multiple match tests.
onkeydown="return numeric(event)"
This will allow only numeric characters to be entered into a field, the back space and the tab key, all others are blocked
onkeydown="return alpha(event)"
This will allow only alphabetic characters to be entered into a field, the back space and the tab key, all numbers are blocked