如何阻止GWTBootstrap3刷新并丢失我的输入并返回错误代码 [英] How to stop GWTBootstrap3 from refreshing and loosing my input and returning an error code

查看:136
本文介绍了如何阻止GWTBootstrap3刷新并丢失我的输入并返回错误代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用GWTootstrap3和以下html:

 < div class =row myheader> 
< div class =col-md-4>
< / div>
< div class =col-md-4>
< h2>欢迎来到Award Tracker登录页面。 < / H2>
< / div>
< div class =col-md-4>
< img class =myimg pull-rightalt =引导图片预览src =1stER_icon_256.png/>
< / div>
< / div> <! - / row - >

< div class =row>
< div class =col-md-12style =text-align:center;>
< h3> < a href =https://www.youtube.com/user/GlyndwrBartlett>教学视频< / a> < / H3>
< / div>
< / div> <! - / row - >

< div class =row>
< div class =col-md-12style =text-align:center;>
< h3> < a href =https://www.metawerx.net/>自豪地得到Metawerx的支持 - 自1997年以来专注于Java托管。< / a> < / H3>
< / div>
< / div> <! - / row - >

< div class =row>
< div class =col-md-12style =text-align:center;>
< button id =privacyPolicyclass =btn btn-large btn-primarytype =submit>隐私和安全政策< / button>
< / div>
< / div> <! - / row - >

< div class =row>
< div class =col-md-12>
< form class =form-signin>
< h2 class =form-signin-heading>请登入< / h2>
< input id =accountNametype =textclass =input-block-levelplaceholder =Email address>
< input id =enterPasswordtype =passwordclass =input-block-levelplaceholder =Password>
< button id =submitclass =btn btn-large btn-primarytype =submit>登入< / button>
< / form>
< / div>
< / div> <! - / row - >

< div class =row>
< div class =col-md-12style =text-align:center;>
< button id =createAccountclass =btn btn-large btn-primarytype =submit>创建帐户< / button>
< button id =updateAccountclass =btn btn-large btn-primarytype =submit>更新帐户< / button>
< button id =forgotPasswordclass =btn btn-large btn-primarytype =submit>我忘记了我的密码< img src =sadFace.jpgwidth =10/ >< /按钮>
< / div>
< / div> <! - / row - >

无论何时按下Signin按钮(或按回车键),页面都会刷新并丢失输入的信息。这也会导致一个错误:


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




你可以这么做:

>

1)< form> 切换为< div> ;



<2> 删除 type =submit从按钮



完成这一切。


I am trying to use GWTootstrap3 with the following 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 -->

Whenever I press the Signin button (or hit enter) the page refreshes and I loose the information entered. This is also resulting in an error:

"Throwable value = com.google.gwt.user.client.rpc.StatusCodeException: 0" being returned to the program. How do I stop the page refreshing please? I use the following to call: btnSignIn.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) {

解决方案

Because you are using a form the page is refreshing.

You can just do this:

1) switch the <form> to <div>

2) remove the type="submit" from the button

That's it your all done.

这篇关于如何阻止GWTBootstrap3刷新并丢失我的输入并返回错误代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆