Thanks,--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Not that I know of. It's a starting point.
--
Lift, the simply functional web framework http://liftweb.net
Simply Lift http://simply.liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
For what it's worth, I've solved this problem using an old technique (actually a technique used to do AJAX before people used XmlHttpRequest, as I recall) that involves just running it as a regular form submitting to a hidden iframe. In the binding, you treat it like a regular ajaxForm and use fileUpload normally.There are two changes you need to make to make this work: one client-side and one server-side. Client-side, in JavaScript, you create a hidden iframe (one with display: none) and give it a name. You then set the form's target to that iframe, update its encoding/enctype, change its action so that it matches the request that lift would make via ajax, and make sure to append the value of the submit button properly. The iframe has an onload event handler that simply evaluates the contents of the iframe.Meantime, server-side, you need to account for IE. Lift serves responses to AJAX requests properly as a JavaScript MIME type, but if you send that to an iframe in IE, IE will try to save it. So, you have to add a bit of code to Boot.scala that will override the MIME type in cases of AJAX file upload requests for IE, resetting it to text/plain, so that IE won't try to save it and your onload handler can do its magic.The relevant blocks of sample code are at https://gist.github.com/392749 . Note that that is designed assuming there is only one submit button; having more than one can complicate things.
Thanks,AntonioPS: This is tested; I've been using it in production for about a year now. It is likely to only work with JsCmd responses, however (i.e., it assumes it has to evaluate the JS directly, so that particular sample code doesn't support JSON).Also note that this is fragile, as it is intimately bound up with how Lift's JS deals with AJAX, so any changes in future versions of Lift to the JS side of AJAX handling could break it.
--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
On Friday, April 22, 2011 at 12:02 , David Pollak wrote:
On Fri, Apr 22, 2011 at 7:58 AM, Antonio Salazar Cardozo <savedf...@gmail.com> wrote:For what it's worth, I've solved this problem using an old technique (actually a technique used to do AJAX before people used XmlHttpRequest, as I recall) that involves just running it as a regular form submitting to a hidden iframe. In the binding, you treat it like a regular ajaxForm and use fileUpload normally.There are two changes you need to make to make this work: one client-side and one server-side. Client-side, in JavaScript, you create a hidden iframe (one with display: none) and give it a name. You then set the form's target to that iframe, update its encoding/enctype, change its action so that it matches the request that lift would make via ajax, and make sure to append the value of the submit button properly. The iframe has an onload event handler that simply evaluates the contents of the iframe.Meantime, server-side, you need to account for IE. Lift serves responses to AJAX requests properly as a JavaScript MIME type, but if you send that to an iframe in IE, IE will try to save it. So, you have to add a bit of code to Boot.scala that will override the MIME type in cases of AJAX file upload requests for IE, resetting it to text/plain, so that IE won't try to save it and your onload handler can do its magic.The relevant blocks of sample code are at https://gist.github.com/392749 . Note that that is designed assuming there is only one submit button; having more than one can complicate things.
Nifty stuff. Thanks for sharing!
Thanks,Antonio
--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
On Saturday, April 23, 2011 at 9:39 , David Pollak wrote:
On Fri, Apr 22, 2011 at 10:01 AM, Antonio Salazar Cardozo <savedf...@gmail.com> wrote:On Friday, April 22, 2011 at 12:02 , David Pollak wrote:
On Fri, Apr 22, 2011 at 7:58 AM, Antonio Salazar Cardozo <savedf...@gmail.com> wrote:The relevant blocks of sample code are at https://gist.github.com/392749 . Note that that is designed assuming there is only one submit button; having more than one can complicate things.
Nifty stuff. Thanks for sharing!Absolutely. Actually, now that I think about it, maybe I should post basically a copy of this onto the wiki somewhere?
Wiki would be great. Having an example project on GitHub would be double-great.
On Monday, May 9, 2011 at 11:21 , Maarten Koopmans wrote:
DOn't have time to look at it, but I have exactly the same. WIth progress feedback via comet, do you have that too in the example?