tags:

views:

247

answers:

3

In GWT, I would like to do something like a form submission that takes me to a new page, with new style sheet and new static elements, and when I get there, be able to extract the values of GWT variables still in GWT. In other words, I want to do most of the form processing on the client side instead of sending it to a servlet to be processed and sent back. Is that possible? Would FormPanel allow me to do that? How do I access the contents of the form fields in GWT on the new page?

A: 

GWT is really meant to be used for the whole application, where "pages" are replaced by application state and URL fragments, and "form submission" is replaced by AJAX calls.

If you want to validate form fields, this can easily be done with regular JS or a library like jQuery.

Jason Hall
Much of my application works the way GWT is meant to be used, but part of it gets a query result from Solr and I want to display it without the static banner and stuff so it can be printed.
Paul Tomblin
+1  A: 

I'm not sure I'm getting the right picture here, but I see several possibilities:

  1. Pass the variables in the url like example.com/myform#create/param1/param2 or any other format you want, then read it using the History class
  2. Use something like this - create an iframe from GWT (maybe put it in Lightbox or something similar), populate it the way you want using the current state of the app, and when the user is finished, he'll just close the (Lightbox) frame and get back to the main application
  3. You could also pass around data in a "hidden" way (no visible data in the url or even through POST) using the window.name hack - there's even a sample implementation for GWT to get you started

ATM, I prefer the second option, since it goes best with the whole no refresh, same page, one app, GWT thing :) That is, unless I'm getting the wrong picture and you want to do something else.

Igor Klimer
A: 

I'm not sure it I get you right either, but for what I'm receiving, having a new page to process the form is not the optimal design. The reason been that you might have to write different GWT app for that which mean overheads, and creating new window (or tab) will move the user's attention away from where they are. Why not using another page WITHIN gwt to process the form with tab panel or hidden panel?

Ning120