Here is how to make it work using dojo: The form:
<form id="myform" action="nodecorate/myaction.action" enctype="multipart/form-data" method="post"> <s:file name="myfile"></s:file> <input type="button" onclick="sendIt(); return false;"> </form> The javascript: function sendIt(){ var bindArgs = { transport: "IframeTransport", formNode: document.getElementById("myform"), mimetype: "text/html", load: function(type, data, evt){ document.getElementById("mydiv").innerHTML = data.firstChild.innerHTML; } }; var request = dojo.io.bind(bindArgs); } The div with id 'mydiv' will then get updated with the response from the action. Jack On 5/13/07, Musachy Barroso <[EMAIL PROTECTED]> wrote:
Try to get it to work with dojo first, no struts involved. I think there has been a couple of posts about this in the mailing list. Let us know if you get it to work as it would make a good FAQ :) musachy On 5/13/07, jf nuzbit <[EMAIL PROTECTED]> wrote: > > Hello, > > Has anyone managed to get a multipart/form-data submission working with > the > ajax theme? > This is what I've got so far: > > <s:form namespace="/nodecorate" action="myaction" > enctype="multipart/form-data" method="post"> > <s:file value="image" name="image"></s:file> > <s:textfield value="title" name="item.title"/>... > > <s:submit theme="ajax" targets="useritems" value="submit"></s:submit> > </s:form> > > Which looks like it's almost working but the target div updates with > '[object HTMLDocument]' and the action never gets invoked. > If i remove the s:file element from the form then everything works as > expected with the div updating with the result from the action. > > This looks to me like a problem with dojo as opposed to Struts2, I'm using > version 2.0.6 by the way. > Has anyone else encountered this or have any ideas? > > Any help appreciated. > Thanks, > > Jack > -- "Hey you! Would you help me to carry the stone?" Pink Floyd