Caplin Trader 4.7.1

Class: module:caplin/core/validator/DecimalValidator

module:caplin/core/validator/DecimalValidator

Constructor

new module:caplin/core/validator/DecimalValidator(errorMessageopt)

The DecimalValidator is a module:caplin/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: