>From the javadoc:
>
> The back-end server is expected to respond with a content-type of 
> 'text/html', meaning that the text returned will be treated as HTML. If any 
> other content-type is specified by the server, then the result HTML sent in 
> the onFormSubmit event will be unpredictable across browsers, and the 
> onSubmitComplete 
> <http://www.gwtproject.org/javadoc/latest/com/google/gwt/user/client/ui/FormPanel.SubmitCompleteHandler.html#onSubmitComplete(com.google.gwt.user.client.ui.FormPanel.SubmitCompleteEvent)>
>  event 
> may not fire at all.

— Source: 
http://www.gwtproject.org/javadoc/latest/com/google/gwt/user/client/ui/FormPanel.html#FormPanel()

If I were you, I'd store the file on the server side and send back a link 
to it (and delete the file when the user's session ends, or after some 
delay). You can then "parse" the body in the onSubmitComplete and open the 
link in a window or hidden iframe (and display the link as a… link, so 
users can click it in case download doesn't automatically start).
The next step is to replace the FormPanel with XMLHttpRequest + FormData 
<http://caniuse.com/formdata>. There's no GWT API for them for now, but I'd 
expect GWT 3.0 to provide them (through Elemental). They're definitely the 
way forward if you don't have to support age-old browsers (you could still 
fallback to FormPanel for those browsers though, just with a degraded 
experience as you're unable to accurately handle errors)

On Wednesday, September 17, 2014 7:28:07 PM UTC+2, [email protected] 
wrote:
>
> I have this scenario I couldn't get right, so any insights are
> apreciated:
>
> A FormPanel contains a FileUpload widget, and the server returns a
> downloadable content:
>
> response.setContentType("application/x-download");
> response.setHeader("Content-Disposition", "attachment; filename=" +
> campaignId + ".xml");
>
> Now, the problem is that altough the upload succedes, and the server
> generated content is perfectly downloadable, the onSubmitComplete
> handle is never called. This is a problem since this way one can't
> clear 'Please wait' messages etc.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to