PDA

View Full Version : server side validation with XmlReader (always success!)



kensugi
10 Jul 2007, 12:29 AM
Hello, everyone.

I've been struggling to display server-side validation result after posting data for some hours...

The validation result is always success, althrogh the server send the following XML data.


<response success="false">
<errors>
<field>
<id>some-id</id>
<msg>error!!</msg>
</field>
</errors>
</response>

As result of debugging ext-all-debug.js and commented out some lines as followings, it works fine!!



processResponse : function(response){
this.response = response;
/*
if(!response.responseText){
return true;
}
*/
this.result = this.handleResponse(response);
return this.result;
}


It is bug, isn't it?

Thanks.

tryanDLS
10 Jul 2007, 2:36 PM
You need to step thru that code. The flow should continue into XmlReader.read where it should process response.responseXml and look at your success attribute, assuming you've set your reader up correctly.

kensugi
10 Jul 2007, 5:33 PM
I follow Ext.form.Action.prototype.processResponse using Firebug, your advice is right if response.responseText isn't vacant.

response.responseText is always vacant in receiving XML data from server, isn't it ?


Incidentally, my form config and submitting data process are just like

new Ext.form.Form({
autoCreate: false,
fileUpload: true,
reader: new Ext.data.XmlReader({
record: 'field',
success: @success},
['id', 'msg']),
errorReader: new Ext.data.XmlReader({
record: 'field',
success: @success},
['id', 'msg'])
});

1). Submit some parameters with file.
2). Validate those in server and send result xml data to client.
3). Client receives result and show it in dialog.

Regards.

jack.slocum
10 Jul 2007, 8:13 PM
This sounds like an old bug. What version are you using?

kensugi
10 Jul 2007, 9:17 PM
Sorry, I've missed to write vesion.

I use 1.1 Beta 2.

mystix
10 Jul 2007, 10:02 PM
pls try your test case with Ext 1.1 RC1 (http://extjs.com/deploy/ext-1.1-rc1.zip).

kensugi
11 Jul 2007, 9:40 PM
I tried 1.1RC1, but same issue applies.

Those codes are around line 24132 in ext-all-debug.js.