7 Replies Latest reply on Oct 6, 2008 9:24 AM by jarmanje

    How to resolve error with DateField being Null value

    jarmanje
      Hello,

      I have been playing with Flex on and off for a while now. I'm getting the hand of it more, but it's simple problems I can't resolve!

      I have a DateField which is loaded from a mysql Database, it all works fine. My problem is when creating a new record in my database (so my array primary key is set to 0)

      here is my datagrid:
      Code:
      <mx:DateField id = "orderdate" formatString="YYYY-MM-DD" width="170" showToday="true" text ="{currentOrder.date}"/>

      and here is my error on line 446 of DateField.as:
      Code:
      TypeError: Error #1009: Cannot access a property or method of a null object reference.
      at mx.controls::DateField$/stringToDate()[E:\dev\3.1.0\frameworks\projects\framework\src\mx\ controls\DateField.as:446]
      at mx.controls::DateField/displayDropdown()[E:\dev\3.1.0\frameworks\projects\framework\src\m x\controls\DateField.as:2118]
      at Function/ http://adobe.com/AS3/2006/builtin::apply()
      at mx.core::UIComponent/callLaterDispatcher2()[E:\dev\3.1.0\frameworks\projects\framework\sr c\mx\core\UIComponent.as:8565]
      at mx.core::UIComponent/callLaterDispatcher()[E:\dev\3.1.0\frameworks\projects\framework\src \mx\core\UIComponent.as:8508]

      Perhaps I add a check if the array value is null and if so make it todays date? How can i do this?