0

我正在尝试将 GWTootstrap3 与以下 html 一起使用:

<div class="row myheader">
    <div class="col-md-4">
        <img class="myimg" alt="Bootstrap Image Preview" src="logo.png" />
    </div>
    <div class="col-md-4">
        <h2> Welcome to the Award Tracker Login Page. </h2>
    </div>
    <div class="col-md-4">
        <img class="myimg  pull-right" alt="Bootstrap Image Preview" src="1stER_icon_256.png" />
    </div>
</div> <!-- /row -->

<div class="row">
    <div class="col-md-12" style="text-align: center;">
        <h3> <a href="https://www.youtube.com/user/GlyndwrBartlett">Instructional videos</a> </h3>
    </div>
</div> <!-- /row -->

<div class="row">
    <div class="col-md-12" style="text-align: center;">
        <h3> <a href="https://www.metawerx.net/">Proudly supported by Metawerx - Specialising in Java hosting since 1997.</a> </h3>
    </div>
</div> <!-- /row -->

<div class="row">
    <div class="col-md-12" style="text-align: center;">
        <button id="privacyPolicy" class="btn btn-large btn-primary" type="submit">Privacy and Security Policy</button>
    </div>
</div> <!-- /row -->

<div class="row">
    <div class="col-md-12">
        <form class="form-signin">
            <h2 class="form-signin-heading">Please sign in</h2>
            <input id="accountName" type="text" class="input-block-level" placeholder="Email address">
            <input id="enterPassword" type="password" class="input-block-level" placeholder="Password">
            <button id="submit" class="btn btn-large btn-primary" type="submit">Sign in</button>
        </form>
    </div>
</div> <!-- /row -->

<div class="row">
    <div class="col-md-12" style="text-align: center;">
        <button id="createAccount" class="btn btn-large btn-primary" type="submit">Create an Account</button>
        <button id="updateAccount" class="btn btn-large btn-primary" type="submit">Update Account</button>
        <button id="forgotPassword" class="btn btn-large btn-primary" type="submit">I forgot my password <img src="sadFace.jpg" width="10" /></button>
    </div>
</div> <!-- /row -->

每当我按下登录按钮(或按回车键)时,页面都会刷新,并且我会丢失输入的信息。这也会导致错误:

“Throwable value = com.google.gwt.user.client.rpc.StatusCodeException: 0”正在返回给程序。请问如何停止页面刷新?我使用以下调用: btnSignIn.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) {

4

2 回答 2

1

因为您使用的是表单,所以页面正在刷新。

你可以这样做:

1)切换<form><div>

2)type="submit"从按钮中删除

这就是你所做的一切。

于 2017-05-16T07:01:27.943 回答
0

GwtBootstrap 表单小部件创建一个真正的<form>标签,该标签尝试在按下提交按钮或 ENTER 时将表单数据提交到表单目标。要防止这种行为,请向表单小部件指明:

<b:Form submitOnEnter="false">
于 2017-05-16T21:21:13.960 回答