Monday, April 20, 2015

Help Posting form with file input using elemental

I've been working on file uploading to AppEngine using the blob store. I would like to do so in the background using elemental (no suggestions for 3rd party libraries please.) I think I have it mostly figured out but I can't figure out the code to get the form data from the form element.

The java script should look like this:
                            var formElement = document.getElementById("formElementID");
                            var request = new XMLHttpRequest();
                            request.open("POST", "urltopostto");
                            request.send(new FormData(formElement));


Here's my java code with elemental. The last line has the part I can't figure out.

                            FormElement formElement = (FormElement) Browser.getDocument().getElementById("uploadForm");
                            XMLHttpRequest request = Browser.getWindow().newXMLHttpRequest();

                            request.open("POST", uploadUrl);
                            request.send(!!!NEED FORM DATA FROM MY FORM ELEMENT HERE!!!!);

General guidance on how to map JS to Elemental code would be great.

 

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment