On 14 oct, 23:40, davis <davisf...@zenoconsulting.biz> wrote:
> Hi, I'm not sure this is necessarily germane to GWT, but I thought I'd
> give it a shot here.
>
> I am using a FormPanel to submit a POST. When the post finishes, I
> return an application/json that I want to do something with.
>
> I have a SubmitCompleteHandler that just logs the response =>
>
> private SubmitCompleteHandler submitCompleteHandler = new
> SubmitCompleteHandler() {
> @Override
> public void onSubmitComplete(SubmitCompleteEvent evt) {
> GWT.log(evt.getResults(), null);
>
> ...but when the form finishes, the browser takes over and pops up a
> dialog that asks if I want to save the file. How do I avoid this, so
> that my code can process the JSON string?
The server has to return text/html (even if it doesn't really contain
HTML but, say, JSON –beware of < and & though–). If you're not
uploading files and/or not using multipart/form-data encoding, I'd
advise you to use a RequestBuilder instead of a FormPanel, it requires
a bit more work (constructing the form dataset by hand) but is far
more flexible (gives you access to response status code and headers,
for instance; and allows you to process application/json response
without the browser messing things up)
See the note in the javadoc for the FormPanel() ctor:
http://google-web-toolkit.googlecode.com/svn/javadoc/1.6/com/google/gwt/user/client/ui/FormPanel.html#FormPanel()
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---