History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: WW-1113
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Ian Roughley
Reporter: firebody
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
WebWork

Remote form bug for multipart enctype ,(upload file ..)

Created: 23/Jan/06 03:40 AM   Updated: 17/Nov/07 02:14 AM
Component/s: None
Affects Version/s: 2.2
Fix Version/s: 2.2.7

Environment: ww2.2 release, jetty , win xp

Flags: Important


 Description  « Hide
<ww:form namespace="/email" id="email" action="createEmail" validate="true"
method="post" enctype="multipart/form-data" theme="ajax" >

           <tr>
<td>attach:</td>
<td><input name="uploadFiles" type="file" value="" size="60"></td>
</tr>

....

</ww:form>

when i clicked the bindButton to submit ,it will return a 'undefine' response ,but server side had successed to receive req and returned response ,cliend side has no any error except that the response showed on the screen is 'undefined' .

 All   Comments   Change History      Sort Order:
Ian Roughley - [15/Mar/06 10:12 PM ]
what happens when a normal form (not remote) is submitted?

firebody - [17/Mar/06 07:11 AM ]
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 .

tm_jee - [18/Mar/07 12:16 AM ]
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

tm_jee - [18/Mar/07 01:06 AM ]
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>

tm_jee - [08/Apr/07 11:17 PM ]
pushing the fix version to "future" it might be resolve if we use a latter version of dojo.

tm_jee - [17/Nov/07 02:14 AM ]
Hi guys,

Closing this issue, as it seems more like an issue with dojo. Please feel free to reopen this if other there's a better sollution.

Cheers.