Class: FieldTest

field_validators.FieldTest()

A set of server side tests which may be used to filter queries These tests assume that the client has done most of the filter testing. These are supposed to be short tests that mostly ensure the form data has come from a valid client.

The heighest level class merely sets up the parameter map of the test, and provides the basic test method, which is overridden here, and should be extensively overridden by applications expecting to use validity tests.

Each extending sublcass will be a test for a particular type of field.

Form fields are tied to FieldTest types of objects by examining the field_type of the field descriptor introducd by configuration. The FieldValidatorTools keeps a table of field class (field_classes), that map from the configuration string to the actual class which can be constructed the field type.

Constructor

new FieldTest()

Source:

Methods

test(field_data, test_params) → {boolean}

Each extending subclass of FieldTest will supply a test method. The object parameter 'field_data' will supply data from the fields of a Form (HTML form). The test method will a also take test parameters, which will supply the syntactic and semantic contraints on the value of the paritcular type of field represented by the class.

Parameters:
Name Type Description
field_data object
test_params object
Source:
Returns:
  • true if the test passes
Type
boolean