-
5 Jul 2012 8:47 AM #1
Answered: Form.reset() and datepicker issue
Answered: Form.reset() and datepicker issue
I have a form with two datepicker fields. If I select some date, then clear my form (button who throws the form.reset() method) and want to reselect some date, I get the following console message :
Uncaught TypeError: Cannot call method 'toDateString' of null
Anyone already had the same issue ?
For information, same issue appears when I clear only the datepicker field with my custom datepicker clear button, code's here :
Code:{ xtype: 'datepickerfield', itemId: 'dateFromField', name: 'dateFrom', locales: { label: 'fields.dateFrom' }, dateFormat: 'd/m/Y', picker : { toolbar : { items : [ { locales: { text: 'buttons.clear' }, ui : 'decline', align : 'right', handler : function(btn) { var picker = btn.up('datepicker'); picker.fireEvent('change', picker, null); picker.hide(); } } ] }, enableLocale : true, locales: { months: 'months' }, yearFrom: 2010, slotOrder:['day', 'month', 'year'] } },
-
Best Answer Posted by mitchellsimoens
What ST2 version are you using? I just tried this with 2.0.0 and 2.0.1.1 and it works without any errors:
Code:new Ext.form.Panel({ fullscreen : true, items : [ { xtype : 'datepickerfield', label : 'Date' }, { xtype : 'button', text : 'Reset', handler : function(button) { var form = button.up('formpanel'); form.reset(); } } ] });
-
5 Jul 2012 5:12 PM #2
Need a value property
-
5 Jul 2012 11:33 PM #3
Ok thank you, it works if I set the value.
But then, if I want to allow the possibility to doesn't specify the date, how can I do it ?
-
6 Jul 2012 11:36 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 436
- Answers
- 3113
What ST2 version are you using? I just tried this with 2.0.0 and 2.0.1.1 and it works without any errors:
Code:new Ext.form.Panel({ fullscreen : true, items : [ { xtype : 'datepickerfield', label : 'Date' }, { xtype : 'button', text : 'Reset', handler : function(button) { var form = button.up('formpanel'); form.reset(); } } ] });Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
8 Jul 2012 5:18 AM #5
I just update the SDK to 2.0.1.1 and it works, I was with the 2.0.1... Don't know what was wrong !
Thank you


Reply With Quote