Use NumberValidator to validate and CurrencyFormatter to format : CurrencyValidator « Data Model « Flex

Home
Flex
1.Chart
2.Components
3.Container
4.Data Model
5.Development
6.Effects
7.Event
8.Graphics
9.Grid
10.Style
Flex » Data Model » CurrencyValidatorScreenshots 
Use NumberValidator to validate and CurrencyFormatter to format
Use NumberValidator to validate and CurrencyFormatter to format
    
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" minWidth="1024" minHeight="768">
        <mx:CurrencyFormatter id="currencyFormatter" currencySymbol="L" thousandsSeparatorFrom="." decimalSeparatorFrom=","/>
        <mx:NumberValidator id="numValidator" property="text"/>
    <mx:Script>
        
            import mx.events.ValidationResultEvent;
            private var vResult:ValidationResultEvent;
            
            private function currencyFormat():void {
                vResult = numValidator.validate(inputCurrency.text);
                if (vResult.type==ValidationResultEvent.VALID) {
                    inputCurrency.text =
                        currencyFormatter.format(inputCurrency.text);
                else {
                    inputCurrency.text= "";
                }
            }
            
      
    </mx:Script>
            <mx:Label text="Currency Input"/>
            <mx:TextInput id="inputCurrency" focusOut="currencyFormat()" width="300"/>
</mx:Application>

   
    
    
    
  
Related examples in the same category
1.Use CurrencyValidator to validate money valuesUse CurrencyValidator to validate money values
2.Using the CurrencyValidator to validate US currencyUsing the CurrencyValidator to validate US currency
3.Using the CurrencyValidator to validate European-formatted priceUsing the CurrencyValidator to validate European-formatted price
4.Using CurrencyValidator class to validate a currency value entered in U.S. dollars and in EurosUsing CurrencyValidator class to validate a currency value entered in U.S. dollars and in Euros
5.Currency formatter cell rendererCurrency formatter cell renderer
6.CurrencyFormatter precisionCurrencyFormatter precision
7.CurrencyFormatter decimalSeparatorToCurrencyFormatter decimalSeparatorTo
8.CurrencyFormatter thousandsSeparatorToCurrencyFormatter thousandsSeparatorTo
9.CurrencyFormatter useThousandsSeparatorCurrencyFormatter useThousandsSeparator
10.CurrencyFormatter useNegativeSignCurrencyFormatter useNegativeSign
11.Example of Currency FormatterExample of Currency Formatter
12.Use CurrencyFormatter and NumberFormatter to format label for ChartUse CurrencyFormatter and NumberFormatter to format label for Chart
13.Using the CurrencyFormatter classUsing the CurrencyFormatter class
w___ww_._j__a___v_a__2__s__.co__m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.