-
6 May 2010 1:07 PM #1
DateField: how to get its value
DateField: how to get its value
I define a date field within a Window like this...
And then I try to set the value of the field like thisCode:new Ext.Window({ ... bbar :[ { xtype : 'datefield', fieldLabel : 'Choose Date', id : 'chooseDate', listeners : { 'select': onDateChange } } ....] ... }
But I get the error "Error: Ext.get("chooseDate").setValue is not a function"Code:Ext.get('chooseDate').setValue('04/02/2010');
Ext.get('chooseDate').getValue() works just fine.
So it seems that I'm getting the DOM element which the DateeField is attached to, but not the fully fledged DateField object itself.
How would I do that?
Thanks,
Paul
-
6 May 2010 1:47 PM #2
Hi,
Ext.get() get the element for a particular component.
You should use Ext.getCmp() to get the component itself.
See the doc about Ext.getCmp() :
http://www.extjs.com/deploy/dev/docs/?class=Ext
Best,
Yannick"Software is like sex: it's better when it's free" - Linus Torvald
https://edit.php.net - A tool written with ExtJs for translated Php documentation
-
6 May 2010 4:15 PM #3
Thank you! I do now recall reading that somewhere.


Reply With Quote