5 Replies Latest reply on Sep 20, 2006 10:21 AM by inlineblue

    Is it bug?

    KostyaS
      At first, sorry for my english.

      Problem description:
      When I set selectedDate property of DateField object at initialization of application and try to select currently selected date, DateField does't deselct this date.

      Description of selectedDate property from Adobe Flex2 Language Reference:
      "Date as selected in the DateChooser control. Accepts a Date object as a parameter.
      Selecting the currently selected date in the control deselects it, sets the selectedDate property to null, and then dispatches the change event." - http://livedocs.macromedia.com/flex/2/langref/mx/controls/DateField.html

      Is it bug? Did anybody encounter this problem? How solve it?
        • 1. Re: Is it bug?
          peterent Level 2
          It depends on when you are setting the date. Doing it in the initialize event won't work; doing it from creationComplete will.
          • 2. Re: Is it bug?
            KostyaS Level 1
            Application MXML file:
            <?xml version="1.0" encoding="utf-8"?>
            <mx:Application
            xmlns:mx=" http://www.adobe.com/2006/mxml"
            layout="absolute"
            creationComplete="fnTest()">
            <mx:Script source="test.as"/>
            <mx:DateField id="idTest"/>
            </mx:Application>

            test.as file:
            // ActionScript file
            public function fnTest():void
            {
            idTest.selectedDate = new Date();
            }

            Try to select currently selected date, DateField object must deselect it.
            • 3. Re: Is it bug?
              vusadube
              I'm getting frustrated actually. "Selecting the currently selected date in the control deselects it, sets the selectedDate property to null," Are they saying if a user clicks the control but doesn't change date the selectedDate returns null?

              My DateFields have bn working fine until i introduced the dateformatter. If I change dates or click them, selectedDate returns null, the debugger confirms it.

              So what method do i use to get the user selected date???
              • 4. Re: Is it bug?
                KostyaS Level 1
                2 vusadube: Right you are, I understood this sentence after third reading, but english not my native lang

                Post example with your problem code.
                • 5. Re: Is it bug?
                  inlineblue Level 1
                  If you use a date formatter, you must specify a parseFunction to "undo" the formatting back into a date. Otherwise, the component has no idea what to do with the custom-formatted text. Yes, they could've implemented this better.