getTextAsDecimal
getTextAsDecimal(): Decimal;
The getTextAsDecimal method returns the text from the textUser property of a JadeEditMask control or the text property of a TextBox control converted to a
If the text of a JadeEditMask control is not a valid numeric string in the locale of the control (for details, see the languageId property), an exception is raised. You should therefore use this method only when the mask property of the control indicates a numeric field (for example, ###,##9.#) that guarantees that the text is a valid numeric.
When the
When the
The text can be valid but incomplete, according to the mask (for details, see the isEmpty and isValid methods).
If the text of a TextBox control is not a valid numeric string in the locale of the user application, an exception is raised. You should therefore use this method only for a numeric text box (that is, the dataType property value of DataType_Numeric (1), DataType_SignedNumeric (2), or DataType_Currency (3)) that guarantees the text is a valid numeric.
The value of decimals property of the text box determines the number of decimal places in the returned decimal.
For the JadeEditMask control, the number of decimal places included in the edit mask determines the number of decimal places in the returned decimal. A numeric JadeEditMask control expects the negative sign, decimal place, and separator characters to be in the form defined for the locale that the control is using.
A numeric TextBox control expects the negative sign and decimal place characters to be in the form defined for the locale under which the user is running. This applies when accessing the text or textUser properties and when the user enters data. Setting decimal text by using the setTextFromDecimal method converts the numeric into the appropriate string for that locale. Retrieving the decimal value using the getTextAsDecimal does the reverse. You can therefore use the getTextAsDecimal and setTextFromDecimal methods to access decimal text so that JADE handles the locale format for you.
The position of a negative sign indicated by the locale is honored by a leading or trailing numeric in the JadeEditMask or TextBox control. However, locales that specify a negative value expressed by parentheses (for example, (123)) are treated as a leading dash symbol (-). In addition, locales that have a leading or trailing space associated with a negative sign are treated as the equivalent format without the space (for example, - 123 will be -123 and 123 - will be 123-).