PDA

View Full Version : form.updateRecord dont word



Forn
16 Apr 2012, 9:51 AM
Hello. I have the next work:


formPersonalData = Ext.getCmp('formPersonalData').getForm();
if (formPersonalData.isValid()){
formPersonalData.updateRecord(currentCustomer);
currentCustomer = formPersonalData.getRecord();
currentCustomer.save({
success: function(record){
Ext.Mesg.alert('Сообщение', 'Данные сохранены.');
},
failure: function(record){
Ext.MessageBox.show({
title: 'Ошибка',
msg: 'Ошибки при сохранении данных. Обратитесь к администратору.',
buttons: Ext.MessageBox.OK,
icon: Ext.MessageBox.ERROR
});
},
})
}


but when the update request send the data in the currentCustomer is that is was before changes in the form.

What I do wrong?

scottmartin
16 Apr 2012, 10:45 AM
Perhaps if you switch the order of these 2 lines?:



formPersonalData.updateRecord(currentCustomer);
currentCustomer = formPersonalData.getRecord();


Regards,
Scott.

Forn
16 Apr 2012, 11:11 AM
Perhaps if you switch the order of these 2 lines?:


Not work. In documentation formPersonalData.updateRecord(currentCustomer); - this must update the currentCustomer from form field, but it not work :(

Forn
17 Apr 2012, 10:28 AM
Problem was solved I must add name for each element except Id.