PDA

View Full Version : Multipartform doesn't catch json-response



Dumas
14 Apr 2009, 4:09 PM
hi!

I've an extjs form which sends data through ajax and catches an json-response.
This form works perfect till I add "fileUpload: true," to the FormPanel.

Then I deosn't get catched by the form, it gets send as a file with I can now download or open in the browser, whats wrong?
Any ideas?

thx
Dumas

chrisvensko
14 Apr 2009, 4:38 PM
When you use fileUpload:true, it tells Ext to submit the form without Ajax using a hidden iFRAME. This acts the same as if you submitted a regular form to a new tab/window.

Dumas
15 Apr 2009, 4:10 AM
And so how can I upload an form with an image in an ajax way?

thx
Dumas

Dumas
16 Apr 2009, 12:19 PM
Can you help me writing an workaround?

How can I catch the json?

thx
Dumas

chrisvensko
16 Apr 2009, 4:45 PM
Dumas,

You can take a look at the Ext.Ajax documentation (http://extjs.com/forum/../deploy/dev/docs/?class=Ext.Ajax). If you look at "request" in the public methods, there are details about how to capture the response, even if it is JSON.

Your request would essentially look something like:


Ext.Ajax.request({
url:url_to_upload_to,
form:form_name,
isUpload:true,
callback:function(opts, success, response) {
// Your code here
}
});


Chris

Dumas
17 Apr 2009, 11:30 AM
Hi!

I couldn't find an answer in the doc, so here's my question:

I create an form like this:

var fs = new Ext.FormPanel({
name: 'editSettings',
...
}and used you code example with:
form:'editSettings',


Firebug returns this Error:
form is null
http://localhost/js/extjs/ext-all-debug.js (http://localhost/OneKlickShop/js/extjs/ext-all-debug.js)
Line 5247: var enctype = form.getAttribute("enctype");

request()(Object url=/admins/editLayout/2.json)ext-all-debug.js (Linie 5247)
handler()()2 (Linie 166)
onClick()(Object browserEvent=Event mouseout button=0 type=mouseout)ext-all-debug.js (Linie 19687)
h()()ext-all-debug.js (Linie 1694)
getViewWidth()()ext-base.js (Linie 10)




whats wrong?

thx
Dumas

Dumas
19 Apr 2009, 1:08 PM
anyone?

Dumas
20 Apr 2009, 5:47 AM
I just tried to replace it with this code:
form:fs.form,

(fs is my formpanel:
var fs = new Ext.FormPanel({..});

But this returns another error:
form.getAttribute is not a function
http://server.de/js/extjs/ext-all-debug.js
Line 5247

Any ideas, please!

thx
Dumas