Form Validation using the SubmitValidation and ChangeValidation patterns

The code for this is within ssValidation.js

This looks at all forms, and attaches validation to them, replacing their default submit action with validation. The validation checks all fields in the form with class "required" or "optional" performs validation on them base on the first three letters of their id (int,str,flt,dat,dtm,mon,txt) if they get through the validation it wil submit the form.

It also attaches change events to each field with class "required" or "optional", and again, any change to the rel or the ‘required/optional’ aspect will take affect when it is next validated.

Other types of validation (e.g. ‘nin’) can be applied to fields by adding a rel attribute to the field e.g. rel="valType:nin". There is no need to modify the name or the id of the field (which in the case of ‘nin’ should be left as ‘str’.

The type of validation for a field can be modified after validation has been attached, by setting a value of rel such as rel="valType:dtm", the ‘required’ or ‘optional’ aspect of a field can aslo be modified after it has been initialised, as the validation looks at this when validating (not when) it gets initialised.

The ‘style’ of validation (i.e. the way that errors are displayed or messages appear) is controlled outside of ssValidation.js, in ssValidationSpecifics.js, where functions called styleWarning clearWarning and showWarning are defined.

It will ignore any forms which have the class "novalidation" (although the change validation will still be applied to the fields within).

There is lots more that could be said about this......