On 18 août, 15:23, Jyaif <[email protected]> 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 [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