I am getting an error when I try to wrap a submit button with GWT:
Caused by: java.lang.AssertionError: Child cannot be null
at com.google.gwt.dom.client.Node$.isOrHasChild$(Node.java:278)
at com.google.gwt.user.client.ui.Button.wrap(Button.java:55)
HTML Code:
<div style="display:none">
<form id="login_form" action="javascript:;">
<input id="username" type="text">
<input id="password" type="password">
<button type="button" id="submit" name="submit" value="Submit">
</form>
</div>
Java Code (GWT):
loginButton = Button.wrap(Document.get().getElementById("submit"));
Is there any way to wrap a submit button?
It does not work because your form is not connected to the DOM-Tree. Remove
display:nonefrom the surrounding<div />and it should work.