Thanks a lot,
I am going to try with setInnerHTML. Currently though, I am adding the
form via an HTML Widget:

String form = "<form id="qwert"  ...  </form>"; // the real html is
downloaded in ajax
HTML htmlWidget = new HTML(form);
RootPanel.get().add(htmlWidget);

Shouldn't that be more or less equivalent to using innerHTML?


On Aug 19, 12:52 am, Thomas Broyer <t.bro...@gmail.com> wrote:
> On 18 août, 15:23, Jyaif <jfgeye...@gmail.com> wrote:
>
> > I am trying to wrap an element in a FormPanel:
>
> > Element element = DOM.getElementById("qwert");
> > Window.alert(element.getInnerHTML()); //the alert is correctly showing
> > me the html
> > formPanel = FormPanel.wrap(element, true); //BOOM, AssertionError:
>
> > java.lang.AssertionError: A widget that has an existing parent widget
> > may not be added to the detach list
>
> > My question is: How can I get an element that has no existing parent
> > widget? It seems impossible to me since to get an Element, it needs to
> > be added to the DOM, and thus must have a parent.
>
> Any element present in the original HTML host page can be used. Any
> element added to such elements via setInnerHTML would be usable too.
> The wrap() methods of widgets are designed for this use-case only:
> enhance existing markup. If you want a FormPanel for an element
> generated by your GWT app, then refactor to use a FormPanel *instead*
> of the element (instead of trying to "enhance" it later on)

-- 
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-tool...@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.

Reply via email to