How to get a reference to elemental.html.FormData

109 views Asked by At

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?

1

There are 1 answers

1
Ümit On BEST ANSWER

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();