DateField in Flex


 

DateField in Flex

In the current tutorial you will come to know about the DateField control of Flex. We use tag to use this control in our programming, we can assign an id to it for referencing from the same MXML file or from any other ActionScript file. The examples will help you to learn DateField more effectively

In the current tutorial you will come to know about the DateField control of Flex. We use tag to use this control in our programming, we can assign an id to it for referencing from the same MXML file or from any other ActionScript file. The examples will help you to learn DateField more effectively

The DateField in Flex:

We use <mx:DateField> tag to use this control in our programming, we can assign an id to it for referencing from the same MXML file or from any other ActionScript file.

DateField control is a text field with a calendar icon at it's right side. If we click either on the text box or on the icon, a calendar appears on the screen.

When the calendar appears, we can select the month and year with the help of navigation keys. If we do not select any date then the text box remains blank.


Example:

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

<mx:Script>

<![CDATA[

private function selectDate(date:Date):String{

return dform1.format(date);

}

]]>

</mx:Script>

<mx:DateFormatter id="dform1" formatString="DD/MM/YYYY" />

<mx:DateField disabledRanges="{[{rangeEnd: new Date(2009,11,31)}]}" id="dfield1" labelFunction="selectDate" parseFunction="null" width="110" horizontalCenter="10" verticalCenter="10" paddingLeft="10" paddingRight="10"/>

</mx:Application>


Output:

Ads