Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-23464

Setting selectedDate in closed handler of DateField doesn't update selectedDate

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • Adobe Flex SDK 3.5 (Release)
    • Apache Flex 4.10.0
    • mx: DateField
    • None
    • Affected OS(s): Windows
      Affected OS(s): Windows XP
      Browser: Internet Explorer 7.x
      Language Found: English

    Description

      Steps to reproduce:
      1. Run attached example (or create your own example, being: datefield with closed handler, inside the closed handler overwrite the selectedDate of the datefield).
      2. Click the DateField and select a date (when using attached example: selected date not being today)
      3. See that the SelectedDate from the closed handler doesn't get reflected

      Actual Results:
      The date set in the closed handler is not set to the date field. The date from the handler is only used when the date chooser is opened and no date is selected (click outside the date chooser).
      The handler is called both times.

      Expected Results:
      The date set in the closed handler to be reflected in the date field.

      Workaround (if any):
      Add a "validateNow()" call after setting the selectedDate:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

      <mx:Script>
      <![CDATA[
      private function myDateClosed(evt:Event):void

      { trace('myDateClosed(event)'); myDate.selectedDate = new Date(); myDate.validateNow(); /* workaround */ }

      ]]
      >
      </mx:Script>

      <mx:ApplicationControlBar dock="true">
      <mx:Label id="sdkVer" initialize="sdkVer.text = mx_internal::VERSION;" />
      </mx:ApplicationControlBar>

      <mx:DateField id="myDate" close="myDateClosed(event);" />

      </mx:Application>

      Attachments

        Activity

          People

            Unassigned Unassigned
            adobejira Adobe JIRA
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: