PDA

View Full Version : cannot get value of a datefield in a form



softwareplay
6 Dec 2013, 6:11 AM
Hello, i'm using exjs4.1, i have a problem with these two lines of code:



start= Ext.util.Format.date(Ext.getCmp('start').getValue(),'Ymd');
end= Ext.util.Format.date(Ext.getCmp('end').getValue(),'Ymd');

I have two datefields with datepicker in the form, the code is below:



{
xtype: 'datefield',
fieldLabel: 'Start date',
format: 'Ymd',
id:"start",
//altFormats: 'Ymd',
listeners: {
'change': function(me) {
alert(me.getSubmitValue());
}
}},
{
xtype: 'datefield',
fieldLabel: 'End date',
format: 'Ymd',
id: "end",
//altFormats: 'm/d/Y',
listeners: {
'change': function(me) {
alert(me.getSubmitValue());
}
}},

Well the listeners that i've set for debug says thet the value is the expected string, but the call at the beginning of the post registers just two empy values. I've even tryed to use:


getSubmitValue()
instead of:

getValue()

but the result is not changed.
How can i get the value that i get in the listeners when the form is submitted?
Thanks
Agnese

scottmartin
6 Dec 2013, 7:20 AM
Do you need the values for submit?
form.getValues()