Hi, with Ext 3.0 the form post response seems to go into a void and does not trigger the call back events. If I use Ext 2.2 instead with the same code the events are triggered.
Here is my form code:
Code:
var regform = new Ext.form.FormPanel({
id: 'newaccountform',
labelWidth: 125,
frame: true,
title: 'Create a new account',
bodyStyle: 'padding:5px 5px 0',
width: 350,
defaults: {
width: 230
},
defaultType: 'textfield',
items: [{
fieldLabel: 'First Name',
name: 'firstname',
allowBlank: false
}, {
fieldLabel: 'Last Name',
name: 'lastname',
allowBlank: false
}, {
fieldLabel: 'Company',
name: 'company'
}, {
fieldLabel: 'Contact Phone',
name: 'phone',
allowBlank: false
}, {
fieldLabel: 'Email Address',
name: 'email',
vtype: 'email'
}, {
id: 'txtUsername',
fieldLabel: 'Username',
name: 'username',
allowBlank: false
}, {
fieldLabel: 'Password',
inputType: "password",
name: 'password'
}],
buttons: [{
text: 'Create Account',
handler: function(){
if (regform.getForm().isValid()) {
regform.getForm().submit({
url: '/content.asp',
params: {
syscmd: 'control',
mod: 'customer',
task: 'MakeSite'
},
waitMsg: 'Submitting your data...',
success: function(form, action){
// server responded with success = true
var result = action.result;
Ext.Msg.alert('Success','It Worked');
},
failure: function(form, action){
if (action.failureType === Ext.form.Action.CONNECT_FAILURE) {
Ext.Msg.alert('Error', 'Status:' + action.response.status + ': ' +
action.response.statusText);
}
if (action.failureType === Ext.form.Action.SERVER_INVALID) {
// server responded with success = false
Ext.Msg.alert('Invalid', action.result.errormsg);
}
}
});
}
}
}, {
text: 'Cancel'
}]
});
On submit, the server returns a text/plain (have also tried HTML and JS response types) response:
Code:
{ "success":false, "message": "Please correct the fields marked in red.", "errors": { "txtUsername": "Username already exists."} }
It doesn't matter if the call succeeds or fails, the loading indicator doesn't go away but the data comes back from the server with a 200 response.
Can anyone please help me with this?
Thank you,
Mike