PDA

View Full Version : getValue() Probem..



yagi
30 Jun 2010, 9:01 PM
Hi All..

I have a form that contain some comboboxes and a textfield.
When I want to save data from those components, there is an error like this "item.getValue is not a function" .
But if I use Ext.getCmp('id').getValue() on each component, the data can be saved.

Here is my code :
For my save button


buttons:[
{
text: 'Save',
iconCls:'icon-disk ',
listeners:
{
click:
{
scope: this,
fn: saveVIMS_comp_group
}
}
}


For saveVIMS_comp_group function


function saveVIMS_comp_group()
{
if(this.getForm().isValid() && this.getForm().findField().getValue())
{
Ext.Ajax.request
({
url: newhid.core.vims_comp_group.controller +'/save',
params: //{
// 'idsite': Ext.getCmp('siteCombo').getValue(),
// 'idfleet': Ext.getCmp('fleetCombo').getValue(),
// 'idprefix': Ext.getCmp('prefixCombo').getValue(),
// 'component_code': Ext.getCmp('compCombo').getValue(),
// 'idmodifier': Ext.getCmp('modifierCombo').getValue(),
// 'order_index': Ext.getCmp('order_index').getValue(),
// 'comp_id': Ext.getCmp('comp_id').getValue(),
// 'action': Ext.getCmp('action').getValue()
// },
this.getFormValues(),
scope: this,
callback: function(options, success, response){
var respon = response.responseText;

if(respon == '1'){
Ext.getCmp('vims_comp_group_grid').getStore().reload();
Ext.MessageBox.alert('Status','Data Has Been Saved..');
}
else if(respon == '1062'){
Ext.MessageBox.alert('Status','Your data can not be saved, Data Duplicated..');
}
else if(respon == '0'){
Ext.MessageBox.alert('Status','Data not found..');
}
else{
Ext.MessageBox.alert('Saving Data Failed..',response.responseText);
}
}
});
}
}


For getFormValues


getFormValues: function()
{
var retVal = {};
this.items.each(function(item) {
retVal[item.name] = item.getValue();
});
return retVal;
}


Could someone help me on this please?

Thanks..

tomtom-
5 Jul 2010, 11:40 AM
Hi yagi,

Try this



getFormValues: function()
{
var retVal = {};
this.items.items.each(function(item) {
retVal[item.name] = item.getValue();
});
return retVal;
}