Hello skar, the date field does not fire an event named changeSelection. Thats why you get the error message you postet. If you want to get the changes of the date, use the changeValue event because that the one working and not deprecated. We moved the implementation form date to value for to get all form items to value. Take a look at the new documentation to see what other things change in the form area: http://qooxdoo.org/documentation/0.8/ui_form_handling2
Now to your formating question. You can give the date field a date formt object which tells the date field what format it should handle. Take a look at the documentation here to see what kinds of formats you can build with the date format: http://demo.qooxdoo.org/devel/apiviewer/#qx.util.format.DateFormat I hope that helps a bit. Regards, Martin skar wrote: > > Hi, > > I've got a datefield like this used on the playground at > http://demo.qooxdoo.org/devel/playground/: > >> // Document is the application root >> var doc = this.getRoot(); >> >> // Add button to document at fixed coordinates >> doc.add(button1, >> { >> left : 100, >> top : 50 >> }); >> >> doc.add(button2, >> { >> left : 100, >> top : 150 >> }); >> >> var date_field = new qx.ui.form.DateField(); >> date_field.addListener("changeValue", function(e) { >> this.debug("ChangeValue: " + e.getData()); >> }, date_field); >> >> date_field.addListener("changeSelection", function(e) { >> this.debug("ChangeSelection: " + e.getData()); >> },date_field); >> var date_format = new qx.util.format.DateFormat("MMM/dd/yyyy"); >> date_field.setDateFormat(date_format); >> doc.add(date_field, {left:300,top:50}); >> >> // Add an event listener >> button1.addListener("execute", function(e) { >> alert("Date field value is:" + date_field.getValue() + " ..."); >> }); >> >> // Add an event listener >> button2.addListener("execute", function(e) { >> alert("Date field date is:" + date_field.getDate() + " ..."); >> }); > When I run this, I get the warning: > >> 006624 There is no event handler for the event 'changeSelection' on >> target 'qx.ui.form.DateField'!Native.js (line 55) > in firebug. But the above code has that handler set. Any ideas why it's > not working? > > If I select a date using the datechooser panel, then both value and date > are returned by pressing the buttons as expected. However, if I enter an > invalid date like "aug/08/2009" it gives me null for both value and > date. But "Aug/08/2009" works fine. So, do I have to enter the date in > the above format and the first letter Caps always? > > Also, is returning "null" for getValue() the way to find out if the date > entered by a user is invalid? Also, getDate() gives me a deprecation > warning. So I should only use getValue() for datefields from now on? > > TIA, > cheers, > skar. > > -- > -- > The life so short, the craft so long to learn. > > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 > 30-Day > trial. Simplify your report design, integration and deployment - and focus > on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > qooxdoo-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel > > -- View this message in context: http://n2.nabble.com/Doubts-about-datefield-tp3430092p3431074.html Sent from the qooxdoo mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ qooxdoo-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
