PDA

View Full Version : Scope Question / form.submit()



Bleak
24 Aug 2010, 9:19 AM
I have a form with a button called btnSave, with the an event handler as follows;


this.component.btnSave.on('click', this.save, this);The save method


save: function() {
var formPanel = this.component.projectForm;

formPanel.el.mask('Please wait...','x-mask-loading');

formPanel.getForm().submit({
url : 'pp.do',
params : {
component: 'project',
entity : 'project',
xaction : 'create'
},
success : this.onSuccessOrFail,
failure : this.onSuccessOrFail

});
}
The onSuccessOrFail method is



onSuccessOrFail : function(form, action) {
var result = action.result;

if ( result.success) {
Ext.MessageBox.alert('Success', action.result.msg);
}else {
Ext.MessageBox.alert('Failure', action.result.msg);
}

}
The issue I have, is that I want to change the scope of the onSuccessFail method, or at minimum be able to pass in additional attributes to the method.