如何使用Flex DateValidator

<?xml version="1.0" encoding="utf-8"?>
<!-- Simple example to demonstrate the DateValidator. -->
<!--
	如何使用Flex DateValidator
	MyShareBook.cn 翻译
-->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

    <mx:Script>
        import mx.controls.Alert;
    </mx:Script>

    <mx:Model id="CheckModel">
        <dateInfo>
            <DOB>{dob.text}</DOB>
        </dateInfo>
    </mx:Model>

    <mx:DateValidator source="{dob}" property="text" allowedFormatChars="/" 
        trigger="{myButton}" triggerEvent="click" 
        valid="Alert.show('Validation Succeeded!');"/>

    <mx:Panel title="DateValidator Example" width="75%" height="75%" 
        paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">

        <mx:Form>
            <mx:FormItem label="Enter date of birth (mm/dd/yyyy): ">
                <mx:TextInput id="dob" width="100%"/>
            </mx:FormItem>

            <mx:FormItem >
                <mx:Button id="myButton" label="Validate" />
            </mx:FormItem>
        </mx:Form>

    </mx:Panel>
</mx:Application>

你可能感兴趣的:(xml,Flex)