|
|
|
[
Permlink
| « Hide
]
Ian Roughley - [15/Mar/06 10:12 PM ]
what happens when a normal form (not remote) is submitted?
if the form is not remote, always work correctly ,just as the sample code in ww2.1.
But i think it could also work correctly in remote form when i upload a file, there is some hints may be handful : the dojo use iframe to upload the file ,and then append the response html to the hidden iframe ,so the data object passed as the parameter of the callback method may be not the actual response . Hi guys
BindButton.js is relying on Bind.js to do xhr request, which relies on dojo.io.bind which by default uses dojo XmlHttp request transport, unfortunately it doesn't support file upload [1] IFrameIO transport [2] does seems to support file upload, but i've only manage to get a fileupload when the mimetype for dojo.io.bind is specified to "text/html", other mime type failed with "Failed To Load Remote Content" (an error occured in dojo.io.bind). With the mimetype="text/html", the jsp to be displayed in a div identified by resultDivId seems to be not as expected as well, it only gives "[object HTMLDocument]" which seems incorrect, its like it never gets parsed. the following is the code that I used :- <div id="result"> Initial content ... </div> <ww:form action="upload" namespace="/nodecorate" theme="ajax" enctype="multipart/form-data" method="post" > <ww:file name="myFile" label="File" /> <ww:submit theme="ajax" resultDivId="result" /> </ww:form> I need to add dojo.require("dojo.io.IframeIO"); to dojoRequire.js and mime="text/html" etc. to get the above results. any thoughts? [1] - http://manual.dojotoolkit.org/WikiHome/DojoDotBook/Book32 [2] - http://manual.dojotoolkit.org/WikiHome/DojoDotBook/Book24 This html page seems to be giving the same results as well :-
<script type="text/javascript"> dojo.require("dojo.io.*"); dojo.require("dojo.io.IframeIO"); function mySubmit() { dojo.io.bind ({ url: '<ww:url action="upload" namespace="/nodecorate" />', handler: callBack, mimetype: "text/html", formNode: dojo.byId('myForm') }); } function callBack(type, data, evt) { dojo.byId('result').innerHTML = data; } </script> <form id="myForm" method="post" enctype="multipart/form-data" action="<ww:url action="upload" namespace="/nodecorate" />" onsubmit="mySubmit(); return false;" > <input type="file" name="myFile" /> <input type="submit" /> </form> </body> </html> | ||||||||||||||||||||||||||||||||||||||||||||||||