I hate it when people answer questions with other questions, but why
would you do this?

Since the form is hidden the user would have no way to submit it,
rendering it useless.  If you want to communicate with the server,
simply set up and use an RPC.

Attempting to answer your questions ...

 1) Yes, I would think the form would need to be added to the
RootPanel to be functional.

 2) If you want to submit this form then yes, it will need to be added
(directly or indirectly) to the RootPanel.  The is no "memory leak" in
submitting a form.

On Dec 28, 11:20 pm, amjibaly <[email protected]> wrote:
> Hi,
>
> I've been playing around with sending an "invisible" form using
> FormPanel:
>
> FormPanel form = new FormPanel();
> form.setAction(url);
> form.setMethod(FormPanel.METHOD_POST);
> form.setEncoding(FormPanel.ENCODING_URLENCODED);
> form.add(new Hidden("abc", "xyz"));
> form.addSubmitCompleteHandler(new SubmitCompleteHandler() {...});
> form.setVisible(false);
> RootPanel.get().add(form);
>
> I have a couple questions regarding this:
>
> 1- If I do not add the form to the RootPanel, the browser opens a new
> window for the response, and the SubmitCompleteHandler event is never
> fired. Is it necessary to add the form to the RootPanel to get the
> correct functionality?
>
> 2- If I do add the form to the RootPanel, would I have to somehow
> remove it later on? Since this code may be executed an arbitrary
> number of times would that cause a problem (memory leak or something)?
>
> Thanks,
> Abdullah

--

You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.


Reply via email to