Caplin Trader 5.1.0

Class: module:ct-core/validator/DecimalValidator

module:ct-core/validator/DecimalValidator(errorMessageopt)

new module:ct-core/validator/DecimalValidator(errorMessageopt)

The DecimalValidator is a module:ct-trading/validation/Validator that ensures the string being validated is an expression of a decimal number. Empty string is allowed: if you don't want to allow empty string, use the module:br-validation/NotEmptyValidator.

Parameters:
Name Type Attributes Description
errorMessage string <optional>

i18n key for error message to be passed to the ValidationResult.

Implements:

Methods

validate(value, attributesopt, validationResult)

Determine whether parsing the given string results in a decimal number and set result on the provided module:br-validation/ValidationResult.

Parameters:
Name Type Attributes Description
value string | number

The value to validate (must be a string, number or undefined).

attributes object <optional>

attributes to control the validation process.

Properties
Name Type Attributes Description
tokens object <optional>

any i18n tokens to be interpolated.

validationResult module:br-validation/ValidationResult

the ValidationResult in which to store the result of this validation.

Implements: