Hi, i'm trying to retrieve a message when the data is successfully saved in a form or when it went wrong, but these callbacks aren't executed
I followed the instructions of this page
http://docs.sencha.com/ext-js/4-0/#!/guide/forms
Here is the code of the form and the model
Code:
Ext.define('sisconse.view.FichaSenagua', {
extend: 'sisconse.view.ui.FichaSenagua',
initComponent: function() {
var me = this;
me.callParent(arguments);
Ext.define('Ficha', {
extend: 'Ext.data.Model',
fields: ['con_id', 'con_formulario', 'con_responsable_datos'],
proxy: {
type: 'ajax',
api: {
read: 'app/data/loadform.php',
create: 'app/data/updateform.php',
update: 'app/data/updateform.php'
},
reader: {
type: 'json',
root: 'data'
},
writer: {
type: 'json',
root: 'data',
encode: true
}
}
});
var numficha = Ext.urlDecode(window.location.search.substring("ficha"));
Ext.ModelMgr.getModel('Ficha').load(numficha, {
//waitMsg: 'Cargando...',
success: function(idficha) {
me.getForm().loadRecord(idficha);
}
});
}
});
And here the code of the button that handles the save action
Code:
Ext.define('sisconse.view.BtnGuardar', {
extend: 'sisconse.view.ui.BtnGuardar',
alias: 'widget.btnguardar',
initComponent: function() {
var me = this;
me.callParent(arguments);
me.on('click', function() {
var form = this.up('form').getForm();
var record = form.getRecord();
if(form.isValid()) {
form.updateRecord(record);
record.save({
success: function(idficha) {
Ext.Msg.alert('Éxito', 'Ficha guardada exitosamente.')
},
failure: function(idficha) {
Ext.Msg.alert('Error', 'Hubo un error al guardar los datos.')
}
});
} else {
Ext.Msg.alert('Datos no válidos', 'Por favor corrija los errores.')
}
});
}
});
And the response from the server when the data was saved
Code:
{"success":true,"msg":"Ficha actualizada exitosamente"}
But the success property is never executed and i can't see any message alert
Thanks in advance for any help