The CurrencyValidator class ensures that a String
represents a valid currency expression.
It can make sure the input falls within a given range
(specified by minValue
and maxValue
),
is non-negative (specified by allowNegative
),
and does not exceed the specified precision
. The
CurrencyValidator class correctly validates formatted and unformatted
currency expressions, e.g., "$12,345.00" and "12345".
You can customize the currencySymbol
, alignSymbol
,
thousandsSeparator
, and decimalSeparator
properties for internationalization.
See also:
Static methods
staticvalidateCurrency(validator:CurrencyValidator, value:Dynamic, baseField:String):Array<ValidationResult>
Convenience method for calling a validator. Each of the standard Flex validators has a similar convenience method.
Parameters:
validator | The CurrencyValidator instance. |
---|---|
value | The object to validate. |
baseField | Text representation of the subfield
specified in the |
Returns:
An Array of ValidationResult objects, with one ValidationResult object for each field examined by the validator.
See also:
Constructor
Variables
alignSymbol:String
Specifies the alignment of the currencySymbol
relative to the rest of the expression.
Acceptable values in Haxe are CurrencyValidatorAlignSymbol.LEFT
,
CurrencyValidatorAlignSymbol.RIGHT
, and
CurrencyValidatorAlignSymbol.ANY
.
See also:
currencySymbol:String
The character String used to specify the currency symbol,
such as "$", "R$", or "£".
Cannot be a digit and must be distinct from the
thousandsSeparator
and the decimalSeparator
.
currencySymbolError:String
Error message when the currency symbol, defined by currencySymbol
,
is in the wrong location.
decimalPointCountError:String
Error message when the decimal separator character occurs more than once.
decimalSeparator:String
The character used to separate the whole
from the fractional part of the number.
Cannot be a digit and must be distinct from the
currencySymbol
and the thousandsSeparator
.
invalidFormatCharsError:String
Error message when the value contains an invalid formatting character.
negativeError:String
Error message when the value is negative and
the allowNegative
property is false
.
precision:Int
The maximum number of digits allowed to follow the decimal point.
Can be any non-negative integer.
Note: Setting to 0
has the same effect as setting NumberValidator.domain
to int
.
Setting it to -1, means it is ignored.
precisionError:String
Error message when the value has a precision that exceeds the value
defined by the precision
property.
thousandsSeparator:String
The character used to separate thousands.
Cannot be a digit and must be distinct from the
currencySymbol
and the decimalSeparator
.