当我尝试使用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代码:
<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代码(GWT):
loginButton = Button.wrap(Document.get().getElementById("submit"));
有没有办法包装提交按钮?
答案 0 :(得分:1)
它不起作用,因为您的表单未连接到DOM树。从周围的display:none
移除<div />
,它应该有效。