Tuesday, April 21, 2015

Re: Help Posting form with file input using elemental

Jens approach should work.
Another approach, for example if you are missing some functions like the append(String name, Blob file, String filename) on elementals interfaces, is this:

public static class ExtJsFormData extends JsFormData {            protected ExtJsFormData() {          }            public final native static ExtJsFormData newExtJsForm() /*-{              return new $wnd.FormData();          }-*/;            public final native void append(String name, Blob file, String filename) /*-{              this.append(name, file, filename);          }-*/;  }  

On Tuesday, April 21, 2015 at 1:44:47 AM UTC+2, Wayne Rasmuss wrote:

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