Constructor
new module:ct-trading /validation /Abstract Field Validator(fields)
Extends:
Parameters:
Name | Type | Description |
---|---|---|
fields |
Array | An array of field names as strings that must be present in the data to validate. Must not be null. |
Throws:
-
if fields is not an array of strings.
- Type
-
module:ct-core
/Error
Extends
Methods
validate(oData ToValidate, oValidation Result)
Validates the supplied data and adds an error map to the validation result if any of the fields are missing, or if the implementing validator deems that the field contains an error. The error object is a map with the field name as the key and the error as the value. Implementing classes should not override this method.
Parameters:
Name | Type | Description |
---|---|---|
oDataToValidate |
module:ct-trading |
The data to validate. Must not be null or undefined. |
oValidationResult |
module:ct-trading |
A |
(abstract) validate Field(field Value) → {String}
Performs validation on the specified field according to rules in the implementing class and returns an error message if the field contains an error.
This method is abstract. Extending classes should implement this method to provide specific validation for a field value.
Parameters:
Name | Type | Description |
---|---|---|
fieldValue |
String | The field value to validate. |
Returns:
The error message that is associated with the field, or null if the field is not in error.
- Type
- String