PDA

View Full Version : Form Submit always submits last record



20 Dec 2010, 11:13 PM
I submit selection from the grid by using following code :
On the server side i always see last record from selection saved for every selection record instead of original one.

var selection = Ext.getCmp(getActiveTabGridId()).selModel.getSelections();
var FormName=GetFormName();
var SubmitForm = Ext.getCmp(FormName).getForm();
for (i = 0 ; i<selection.length ; i++)
{
item=selection[i];
SubmitForm.loadRecord(item);
SubmitForm.submit({
url: 'blabla.php?',
method:'POST',
waitTitle:'Connecting',
waitMsg:'Sending data...',
success:function(){

Ext.Msg.alert('Request submitted');
},
failure:function(form,action)
{
if(action.failureType == 'server')
{
obj = Ext.util.JSON.decode(action.response.responseText);
Ext.Msg.alert('Request failed!', obj.errors.reason);
}
else
{
Ext.Msg.alert('Request failed');
Ext.Msg.alert('Warning!', 'Server is unreachable : ' + action.response.responseText);
}
} // end of failure
}); // end of submit
.....