PDA

View Full Version : submit dynamic form and get error at ext-all-debug.js (line 6115)



zhouwanquansa
20 May 2007, 12:05 PM
i submit dynamic form to upload a file,the server response json like this:

{'success':true,'saved':'yes','error':'NOERROR.'}.
but,the firebug pop a error:

missing } in XML expression
[Break on this error] (<pre>{'success':true,'saved':'yes','error':'NOERROR.'}</pre>) ... ext-all-debug.js (line 6115)

my form define like this:


this.form = new Ext.form.Form({
labelAlign: 'right',
labelWidth: this.labelWidth,
style:'padding-top:10px',
action:'/pubinfo.ul',
fileUpload: true
});
...

and my handler :


this.form.on('actioncomplete', function(form, action) {
if(action.result.saved == 'yes'){
Ext.Msg.alert('info','yes');
}
};
this.form.on('actionfailed', function(form, action) {
if(action.result.saved == 'no'){
Ext.Msg.alert('info','failed');
}
}

my test link:http://www.qudee.com/testext2.jsp

Steed zhou. thanks for your help!

jsakalos
20 May 2007, 3:03 PM
Just tip... Try to put to your json double quotes instead of single.

zhouwanquansa
20 May 2007, 3:51 PM
I Tried to put to my json double quotes instead of single.
and evaluate the code in javascript console:

(<pre>{"success":true,"saved":"yes","error":"NOERROR."}</pre>)

and get the same error:

462

jsakalos
20 May 2007, 4:12 PM
Is the <pre> tag part of the json? Shouldn't be.

zhouwanquansa
20 May 2007, 5:59 PM
Yes,the <pre> is not a part of json.
response from the servlet is:

{"success":true,"saved":"yes","error":"NOERROR."}

But,i add alert function to the line 6115 of ext-all-debug,and like this:



this.decode = function(json){
alert(json); //add to test
return eval("(" + json + ')');
};


And get the message:


<pre>{"success":true,"saved":"yes","error":"NOERROR."}</pre>

I don't know where is the <pre> come from ...

And other,I tried it in IE6 ,is fine . But Firefox 2.0.0.3 is not.

zhouwanquansa
20 May 2007, 6:38 PM
And more,I already tried it in Firefox 1.5.0.10,is FINE.

jsakalos
21 May 2007, 2:20 AM
But,i add alert function to the line 6115 of ext-all-debug,and like this:



this.decode = function(json){
alert(json); //add to test
return eval("(" + json + ')');
};

And get the message:




<pre>{"success":true,"saved":"yes","error":"NOERROR."}</pre>

I don't know where is the <pre> come from ...
Alert doesn't do any formatting so if alert outputs <pre> .... then <pre> is there.

What is server response seen in Firebug?

zhouwanquansa
21 May 2007, 4:32 AM
In firebug ,The server response like:

{"success":true,"saved":"yes","error":"NOERROR."}

jsakalos
21 May 2007, 4:37 AM
In firebug ,The server response like:

{"success":true,"saved":"yes","error":"NOERROR."}

And still error? 'Cause json is correct now. If yes, trace the code to find out.

zhouwanquansa
21 May 2007, 4:37 AM
464

jsakalos
21 May 2007, 4:38 AM
Oh, one more: What about returned Content-type?

zhouwanquansa
21 May 2007, 4:56 AM
Still error in Firefox 2.0.0.3 .

If use Firefox 1.5.0.10 then The response like:


{"success":true,"saved":"yes","error":"NOERROR."}

If use Firefox 2.0.0.3 then The response like:


<pre>{"success":true,"saved":"yes","error":"NOERROR."}<pre>

:)

Why ? Can u help me ?

zhouwanquansa
21 May 2007, 5:13 AM
"text/plain"

jsakalos
21 May 2007, 5:36 AM
text/plain should do but "application/json; charset=utf-8" is fully correct (your charset of course).

I don't know about FF 1.5/Firebug but these <pre>'s mustn't be in the server response. Check the server.

zhouwanquansa
21 May 2007, 5:39 AM
Thanks jsakalos.
I checking ...

steven
4 Jun 2007, 6:32 AM
I'm getting the exact same error. Any luck with this?

jsakalos
4 Jun 2007, 2:25 PM
Well, the only certainty here is that if the server response contains "<pre>" it just cannot work. I don't know what do you use on server-side to generate json. I use PHP so if I'd do just:



echo '{"success":true,"saved":"yes","error":"NOERROR."}';
I'd send correct JSON to client.

JasonMichael
8 Jun 2007, 11:27 PM
perhaps that's the problem - nothing at all may be getting generated. From my tests, using the dynamic form, even though I hit submit, it never touches my PHP script to process the form... if it did, my script would be creating a file with a print_r of my $_FILES.... so I'm convinced that this is a bug with dynamic forms or something or the submit doesn't work....

jsakalos
9 Jun 2007, 2:10 AM
perhaps that's the problem - nothing at all may be getting generated. From my tests, using the dynamic form, even though I hit submit, it never touches my PHP script to process the form... if it did, my script would be creating a file with a print_r of my $_FILES.... so I'm convinced that this is a bug with dynamic forms or something or the submit doesn't work....

If you copy&pasted the dynamic form example to your server you have to adjust at least url the from submits to. Check with firebug what is url of request. Should be your PHP script address.

JasonMichael
9 Jun 2007, 8:53 AM
Okay, thanks... I think Firebug will be my friend someday soon (I have to figure it out). I've been just using basic Firefox console messages to debug with. There have been alot of folks having this problem lately - more than usual number of posts with this problem, this week. I'll try to figure it out in order to help.

Jason

JasonMichael
9 Jun 2007, 9:49 AM
Okay, i think I figured out the problem... Its a parse error (a typo) in ext-all.js, starting with the standalone version I think.....

I'll get this posted in the bugs section.

Jason

JasonMichael
9 Jun 2007, 10:03 AM
Line 6116 of ext-all-debug.js (on my version) reads:


this.decode = function(json){
return eval("("+ json + ')');
};

and I it works better when I change it to :



this.decode = function(json){
return eval("('+ json + ')");
};