Validation

Data is validated every time when a client request is received by the server with values to update the operation context. There are two types of validation, single data field validation and business functions cross-field validation.

In single data field validation, the validator performs a syntactic validation to check whether the data is valid for the field. After the data has been validated syntactically, it can be validated semantically. Semantic validation checks whether the data complies with the specified business rules.

For example, a due date is set for a transfer, and the due date can only be a business date. The validator first checks (a syntax validation) that the due date field contains a valid value. If the date is valid, the cross-field validator checks whether the due date is a business data (a semantic validation).

The typed data field definitions in the dsetype.xml file contain the required validation rules for the single data field syntactic validation. The field validation goes through the KeyedCollection, finds the data element in the context with the same name as the data element in the file, and validates the data element (syntactically by the data field validator and semantically by the operation cross-field validator); if the validation is successful, the context is updated. All the exceptions received for each field during the validation are added to a Hashtable object which is kept in the errorInfo attribute of the data element. This attribute is later used by the JSP to display the error related to a field. See Performing validation.

After performing the single data field validation (both syntactic and semantic), the toolkit performs a cross-field validation of the relationship between the value of the current field and the value of another field. An example of the relationship validation is that an address cross-field validator's checking whether the zip code is valid for the state which is identified in another field. See Performing cross-field validation.

Although a semantic validation is a field validation, the cross-field validator is the object that performs the checking procedure. This is because the semantic validation and the cross-field validation require a context. The cross-field validation requires the context because it uses more than one field to validate the data. The semantic validation requires the context because the meaning of the field might vary depending on the field status inside the context.