[solved][4.1 RC3] form errorReader as Ext.data.reader.Xml does not fire markInvalid()
Hi Folks,
I have a form basically identical to your xmlForm example. When the submit() function fires it does not fire the markInvalid() function on return.
Before anybody asks, "yes" I'm sure my xml return is actually xml.
My research shows Ext.form.action.Submit.onSuccess does not set the result var correctly so result.errors is null/undefined when this.processResponse returns
Code:
onSuccess: function(response) {
var form = this.form,
success = true,
result = this.processResponse(response);
if (result !== true && !result.success) {
if (result.errors) {
form.markInvalid(result.errors);
}
this.failureType = Ext.form.action.Action.SERVER_INVALID;
success = false;
}
form.afterAction(this, success);
},
My xml is...
Code:
<?xml version="1.0" encoding="UTF-8" ?>
<message success="false">
<errors>
<field>
<id>pUserName</id>
<msg><![CDATA[Invalid username/password combination.]]></msg>
</field>
<field>
<id>pPassword</id>
<msg><![CDATA[Invalid username/password combination.]]></msg>
</field>
</errors>
</message>
My form is...
Code:
Ext.onReady(function() {
Ext.define('Songle.fielderror', {
extend: 'Ext.data.Model',
fields: ['id', 'msg']
});
Ext.create('Ext.form.Panel', {
renderTo : "logonForm",
title : 'Songle Logon',
id: "LogonPanel",
bodyStyle : 'padding: 30px',
width : 400,
waitMsgTarget: true,
// configure how to read the XML errors
errorReader: Ext.create('Ext.data.reader.Xml', {
model: 'Songle.fielderror',
record : 'id',
successProperty: '@success'
}),
fieldDefaults : {
labelAlign : 'top',
msgTarget : 'side'
},
defaults : {
border : false,
xtype : 'panel',
flex : 1,
layout : 'anchor'
},
items : [{
xtype : 'textfield',
fieldLabel : 'Username or email',
anchor : '100%',
cls: "loginlabel",
name : 'pUserName',
allowBlank: false
}, {
xtype : 'textfield',
fieldLabel : 'Password',
anchor : '100%',
cls: "loginlabel",
name : 'pPassword',
inputType: 'password',
allowBlank: false
}],
buttons : ['->', {
text : 'Logon',
disabled: true,
formBind: true,
handler: function(){
var f = this.up('form').getForm();
f.submit({
url: '../songledb/s2_access.logon',
submitEmptyText: false,
waitMsg: 'Checking Username and Password...'
});
}
}]
});
});