I'm trying to get an AJAX form submission to take JSON response data and consider it a success using a different key besides success: true (default). I've tried just about everything I can imagine, but still can't figure this out.
Actually, I will say this. I know that successProperty isn't listed as a supported method, so why should I expect it to work? I guess I expected it to because it's an AJAX request. Is there any other way to modify the parameters before sending the data?
You may be wondering: And why can't I just write success: true into the JSON API? Short answer - it's not mine.
Any help, tips, pointers are greatly appreciated!
Take care,
Cameron
Code:
this.homeLoginForm = new Ext.form.FormPanel({
successProperty: 'somethingElse', // override the default success: true
standardSubmit: false,
itemId: 'homeLoginForm',
url: 'dummydata/post.php',
defaults: {
labelWidth: '33%',
required: true,
},
items: [{
xtype: 'fieldset',
title: 'Log In',
instructions: "Please log in",
items: [
{
xtype: 'textfield',
name : 'email',
label: 'Email',
},
{
xtype: 'passwordfield',
name : 'password',
label: 'Password',
},
]
},
new Ext.Panel({ //sticking a little panel in there for better button positioning
layout: {
type: 'hbox',
pack: 'end',
align: 'stretch'
},
items: [
new Ext.Button({ //the submit button
text: 'Log In',
listeners: {
tap: function(){
//console.log("Form ", Home.homeLoginForm.items.items[0].items.items);
console.log("Hit submit", Home.homeLoginForm.submit());
}
}
}),
]
})
],
dockedItems: [
{
title: 'Home',
dock: 'top',
layout: { pack: 'end'},
xtype: 'toolbar',
}],
listeners : {
submit : function(form, result){
console.log('success', Ext.toArray(arguments));
},
exception : function(form, result){
console.log('failure', result);
// console.log('failure', Ext.toArray(arguments));
}
},
});