Use TextInput as the Credit card number data source : TextInput Data « Components « Flex






Use TextInput as the Credit card number data source

Use TextInput as the Credit card number data source
          
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" verticalAlign="middle" horizontalAlign="center">
    <mx:Script>
        
            import mx.controls.Alert;
      
    </mx:Script>
    <mx:Model id="creditcard">
        <card>
            <cardType>{cardTypeCombo.selectedItem.data}</cardType>
            <cardNumber>{creditCardInput.text}</cardNumber>
        </card>
    </mx:Model>
    <mx:Panel title="Data Validation">
        <mx:ComboBox id="cardTypeCombo">
            <mx:dataProvider>
                <mx:Object label="American Express" data="American Express" />
                <mx:Object label="MasterCard" data="MasterCard" />
                <mx:Object label="Visa" data="Visa" />
            </mx:dataProvider>
        </mx:ComboBox>
        <mx:TextInput id="creditCardInput" restrict="1234567890" />
        <mx:Button label="Validate" click="ccv.validate()" />
    </mx:Panel>
    <mx:CreditCardValidator id="ccv"
        cardTypeSource="{creditcard}"
        cardTypeProperty="cardType"
        cardNumberSource="{creditcard}"
        cardNumberProperty="cardNumber"
        cardTypeListener="{cardTypeCombo}"
        cardNumberListener="{creditCardInput}"
        valid="Alert.show('Credit card is valid')" />    
</mx:Application>

   
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Using actionscript to access TextInput data in TextUsing actionscript to access TextInput data in Text
2.Show an MXML-based data model with properties of TextInput controls bound into its fieldsShow an MXML-based data model with properties of TextInput controls bound into its fields
3.A TextInput's text property is bound to two data models, and data model properties are bound to the text properties of two Label controls.A TextInput's text property is bound to two data models, and data model properties are bound to the text properties of two Label controls.
4.shows an MXML-based data model with properties of TextInput controls bound into its fields:shows an MXML-based data model with properties of TextInput controls bound into its fields:
5.Max char and restrict letter for TextInputMax char and restrict letter for TextInput
6.Restrict input letter for TextInputRestrict input letter for TextInput
7.Add item to a list from TextInputAdd item to a list from TextInput