Threaded View
-
22 Jan 2013 12:19 PM #11
The use case for this particular situation is to open a window that harbors a FormPanel with two fields (one being the FileUploadField.) This window is modal, and does not close until the onSubmit event finishes processing (which should be after the submit completes, if I understand the API correctly.)
That's the general gist/use-case. To my understanding, the FormPanel should always be attached in this scenario, right?Code:Window w = new Window(); FormPanel fp = new FormPanel(); VerticalLayoutContainer vlc = new VerticalLayoutContainer(); w.setWidget(fp); fp.setWidget(vlc); ... // other widget setup -- FileUploadField and TextArea into vlc, etc fp.setMethod(FormPanel.Method.POST); fp.setEncoding(FormPanel.Encoding.MULTIPART); fp.setAction(GWT.getHostPageBaseURL() + "datatransfer"); fp.addSubmitHandler(new SubmitHandler() { @Override public void onSubmit(SubmitEvent event) { // processing Utils.getSvc().doThing(selected, new AsyncCallback<AdViewGwt>() { @Override public void onFailure(Throwable caught) { Utils.reportError(caught, "Unable to attach file!"); } @Override public void onSuccess(BaseModel result) { selected.set("addFile", null); w.hide(); } }); } }); note.addButton(new TextButton("Save", new SelectHandler() { @Override public void onSelect(SelectEvent ce) { fp.submit(); } }));
Looks like we can't reproduce the issue or there's a problem in the test case provided.


Reply With Quote