Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用gwt和gwtbootstrap3提交表单而不刷新页面_Gwt_Gwtbootstrap3 - Fatal编程技术网

使用gwt和gwtbootstrap3提交表单而不刷新页面

使用gwt和gwtbootstrap3提交表单而不刷新页面,gwt,gwtbootstrap3,Gwt,Gwtbootstrap3,我在gwt项目中使用gwt和gwtbootstrap3。我的代码看起来像 <b:NavbarForm pull="LEFT"> <b:TextBox placeholder="Search" addStyleNames="col-lg-8"/> </b:NavbarForm> 现在,如果我在文本框中键入任何内容并按enter键,gwt将重新加载整个页面,这是我不想看到的,我只想从文本框中获取值并调用一个方法。我有没有办法做到这一点

我在gwt项目中使用gwt和gwtbootstrap3。我的代码看起来像

  <b:NavbarForm pull="LEFT">
      <b:TextBox placeholder="Search" addStyleNames="col-lg-8"/>
    </b:NavbarForm>

现在,如果我在文本框中键入任何内容并按enter键,gwt将重新加载整个页面,这是我不想看到的,我只想从文本框中获取值并调用一个方法。我有没有办法做到这一点

仅供参考,如果我不使用NavbarForm,我可以获取该值,但我无法使搜索框内联


仅供参考,如果我将文本框包装在其他容器(如NavbarText或NavbarNav)中,则只是一个更新。UI已损坏。

这可能是gwtbootstrap3中的一个错误-他们最近对表单小部件进行了彻底检查

但现在,您可以向
NavbarForm
添加
SubmitHandler
,并取消
SubmitEvent
,以防止其重新加载页面:

navbarForm.addSubmitHandler(新SubmitHandler(){
@凌驾
提交时公共无效(提交事件){
event.cancel();
}
});
使用UiBinder时:

@UiHandler(“navbarForm”)
无效onNavbarSubmit(提交事件){
event.cancel();
}

注意,在本例中,
SubmitEvent
的类型是
org.gwtbootstrap3.client.ui.base.form.AbstractForm.SubmitEvent
不是
com.google.gwt.user.client.ui.FormPanel.SubmitEvent
,我正在使用UiBinder,当我试图添加@UiHandler(“navbarForm”)时,它给了我一个错误
[错误]字段“navbarForm”没有关联的“addFormPanel.SubmitHandler”方法
。感谢您的回复,但我找不到
org.gwtbootstrap3.client.ui.base.form.AbstractForm.SubmitEvent
类,我的类路径中有gwtbootstrap3-0.8.1.jar`它是0.9版本,最近发布的。应在Maven Central上提供: