Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

New Contributor
Posts: 2
Registered: ‎10-19-2010
My Device: Not Specified

DateField field changed issue

Hi everyone,


I'm having an issue with the DateField control.


I am setting the initial value of the control to be Long.MIN_VALUE - according to the documentation, this will display a blank date. I need to do this as the user should have the option to NOT select a date if they don't want to.


If I click the blank date, the picker will pop up, allowing me to select a date. This defaults to today's date. If I pick a date/time other than the default value and click OK, the date/time displayed by the form updates correctly. However, if I keep with the default value and just click OK (therefore accepting the default), the date/time is NOT displayed, and the Long.MIN_VALUE date is returned if I call getDate() on the DateField.


I have attached a field change listener and can confirm that the event is not fired when you accept the default value when coming from a blank date/time. However, if you select another date, it is fired ok.


This seems like a bug in the control to me, so I was wondering if anyone else has encountered this problem, or if anyone has any suggestions as to how to get around it?


The code I've written to create the DateField is as follows:


long initialDateTime = Long.MIN_VALUE;

DateField dateField = new DateField("Select date", initialDateTime, DateField.DATE_TIME);


Thanks in advance!



Posts: 17,003
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: DateField field changed issue

welcome to the support forums.


this looks like a bug to me. you can report it here:



as a workaround you could maybe overwrite navigationclick and set the default value.

or place a checkbox nearby allowing the user to activate/deactivate the date field, initializing it with the current date.

feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Contributor
Posts: 2
Registered: ‎10-19-2010
My Device: Not Specified

Re: DateField field changed issue

Hi Simon,


Thanks for your welcome and your help!


I've overridden the navigationClick method and made it replace the date value with the current time if it is blank. I've also added a button to the right of the field that will "clear" the date by putting Long.MIN_DATE in there. This will do for now. I'm going to submit a bug for this as well.


Thanks a lot for your suggestion!



Posts: 48
Registered: ‎03-04-2009
My Device: Not Specified

Re: DateField field changed issue


  I am Facing same issue.  solution please???



Suresh Kerai