Class: FieldValidatorTools

field_validators.FieldValidatorTools()

A class that helps apply the field filter tests... This class manages the creation of the lookup table for assigning classes set up in the filed classes table to class instances that provide test methods.

When the validator is created, the form identifiers and the field identifiers will be put together for the verifier access when checking fields associated with post requests.

The table application_tests maps the concatinated form name + field name to the test class instance.

Constructor

new FieldValidatorTools()

Source:

Methods

generate_tester(fieldDescriptor) → {boolean|object}

Given the field descriptor from a configuration, identifies the constructor from field_type of the descriptor. Creates a new instance of the FieldTest type of object

Parameters:
Name Type Description
fieldDescriptor object
Source:
Returns:

false if the class constructor is not in the table, otherwise a new class instance

Type
boolean | object

get_field_test(form, field) → {object}

The validation method of the application's validator calls this to get a test method to apply to the field of the form. Use the concatenated form idenifier/field identifier key to find the test. Returns the FieldTest instance.

Parameters:
Name Type Description
form string
field string
Source:
Returns:
Type
object

init_field_classes()

Source:
Returns:
  • list of field classes configured for this application

setup_field_test(form, field, fieldDescriptor)

Concatinates the form idenifier with the field identifier to make a key for the new verification test entry. Add the key, value pair to the application_tests table.

Parameters:
Name Type Description
form string
field string
fieldDescriptor object
Source: