PDA

View Full Version : How to get value from formPanel??



yagi
1 Jul 2010, 12:06 AM
Hi All..

I have a form with some components such as combobox and textfield. In my button listeners, I call a method for saving the data. I'm using Ext.Ajax.request. What i'm asking is how to get all values in the form without using Ext.getCmp? because I'm still using it. I know, I have to create a function to get the values by looping. But I don't know how to create it. And then, How to reset the form after saving data successfully?

Here is my code :
For my button listeners


listeners:
{
click:
{
scope: this,
fn: saveVIMS_comp_group
}
}


For my save 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()
},

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..');
// HOW TO REFRESH THE FORM AFTER SAVING? IT SHOULD BE HERE..
}
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);
}
}
});
}

Can someone give me an example code please?


Thanks..

Animal
1 Jul 2010, 12:32 AM
http://www.sencha.com/deploy/dev/docs/?class=Ext.form.BasicForm&member=getFieldValues

tryanDLS
1 Jul 2010, 6:57 AM
Please do not cross post.