I sign the form on the 3 events but the event 'actioncomplete' not fired. The other two events are executed, success callback is performed.
if(obj instanceof Ext.form.BasicForm){
var before='beforeaction';
var complete='actioncomplete';
var error='actionfailed';
}
obj.addListener( before,
function(o,e) {
this.changeSysState(lang[msg_id].loading,'loading','load_N_'+this.load_id);
}, this);
obj.addListener( complete,
function(o,e) {
this.showStatus(lang[msg_id].complete,'complete','load_N_'+this.load_id);
obj.addListener( error,
function(o,e) {
this.changeSysState(lang[msg_id].error,'error','load_N_'+this.load_id);
}, this);
My form
var changePanel = new Ext.form.FormPanel({
labelWidth : 132,
layout : 'form',
border : false,
defaults:{allowBlank:false,width:165},
url : '/xstore/xstore_change_pass.php',
items : [ /*some fields*/ ]
});
submit call
var form = changePanel.getForm();
form.submit({
success: function(r,o) {
winPass.destroy();
}
});
Server returns
{"success":true}
Use ExtJs 3.4
With that response, actioncomplete
should be fired. You should search for reasons why it isn't. I see some issues with your code that might causing this behaviour:
you declared before
, complete
, error
as local variables and you use them out of scope; this might be an issue; use that instead:
if(obj instanceof Ext.form.BasicForm){
var before='beforeaction';
var complete='actioncomplete';
var error='actionfailed';
obj.addListener( before, function(o,e) {
this.changeSysState(lang[msg_id].loading,'loading','load_N_'+this.load_id);
}, this);
obj.addListener( complete, function(o,e) {
this.showStatus(lang[msg_id].complete,'complete','load_N_'+this.load_id);
}, this);
obj.addListener( error, function(o,e) {
this.changeSysState(lang[msg_id].error,'error','load_N_'+this.load_id);
}, this);
}
you destroy something in success
callback; this success
callback is fired before actioncomplete
, so if it also destroys form it might be another issue
If neither of those help, check in developer tools for server response. There might be some error code returned which also might be the reason.
Here is fiddle where you can see the second problem (actioncomplete
not firing after destroying form).