gwtgwt-elemental

How to get a reference to elemental.html.FormData


I'm sure this is a simple problem... I am trying to use elementals FormData in gwt.

How do I get a reference to it? There is a JsFormData

public class JsFormData extends JsElementalMixinBase  implements FormData {
  protected JsFormData() {}

  public final native void append(String name, String value, String filename) /*-{
    this.append(name, value, filename);
  }-*/;
}

But this has a protected constructor... and I can't find any other reference to FormData...

Do I need to subclass this?


Solution

  • Something like this should work:

    public final native static JsFormData newJsFormData() /*-{
        return new $wnd.FormData();
    }-*/;
    

    and then you can simply call it

    JsFormData formData = newJsFormData();