Index: engine.js =================================================================== --- engine.js (revision 2687) +++ engine.js (working copy) @@ -1466,19 +1466,20 @@ batch.encType = "multipart/form-data"; } var idname = dwr.engine.transport.iframe.getId(batch); - batch.div = document.createElement("div"); if (dwr.engine.isIE) { - document.body.appendChild(batch.div); - batch.div.innerHTML = ""; - batch.iframe = batch.div.firstChild; - } else { - batch.iframe = document.createElement("iframe"); - batch.iframe.setAttribute("id", idname); - batch.iframe.setAttribute("name", idname); - batch.iframe.setAttribute("frameborder", "0"); - batch.iframe.setAttribute("src", "about:blank"); - batch.iframe.setAttribute("onload", "dwr.engine.transport.iframe.loadingComplete(" + batch.map.batchId + ");"); - document.body.appendChild(batch.iframe); + batch.div = document.createElement("div"); + document.body.appendChild(batch.div); + batch.div.innerHTML = ""; + batch.iframe = batch.div.firstChild; + } else { + batch.iframe = document.createElement("iframe"); + batch.iframe.setAttribute("id", idname); + batch.iframe.setAttribute("name", idname); + batch.iframe.setAttribute("frameborder", "0"); + batch.iframe.setAttribute("src", "about:blank"); + batch.iframe.setAttribute("style", "width:0px;height:0px;border:0;visibility:hidden;"); + batch.iframe.setAttribute("onload", "dwr.engine.transport.iframe.loadingComplete(" + batch.map.batchId + ");"); + document.body.appendChild(batch.iframe); } batch.document = document; dwr.engine.transport.iframe.beginLoader(batch, idname); @@ -1510,12 +1511,16 @@ // TODO: On firefox we can now get the values of file fields, maybe we should use this // See http://soakedandsoaped.com/articles/read/firefox-3-native-ajax-file-upload // setting enctype via the DOM does not work in IE, create the form using innerHTML instead - var formHtml = "
"; - var div = batch.document.createElement("div"); - div.innerHTML = formHtml; - batch.form = div.firstChild; + batch.form = batch.document.createElement("form"); + batch.form.setAttribute("id", "dwr-form-" + idname); + batch.form.setAttribute("action", request.url); + batch.form.setAttribute("target", idname); + batch.form.setAttribute("style", "display:none"); + batch.form.setAttribute("method", batch.httpMethod); + if (batch.encType) { + batch.form.setAttribute("encType", batch.encType); + batch.form.setAttribute("encoding", batch.encType); + } for (var prop in batch.map) { var value = batch.map[prop]; if (typeof value != "function") { @@ -1537,7 +1542,7 @@ } } } - batch.document.body.appendChild(batch.form); + document.body.appendChild(batch.form); batch.form.submit(); } }, @@ -1549,7 +1554,8 @@ */ loadingComplete:function(batchId) { var batch = dwr.engine._batches[batchId]; - if (batch) dwr.engine.batch.validate(batch); + if (batch && batch.iframe && (batch.iframe.src != "about:blank")) + dwr.engine.batch.validate(batch); }, /**