htmlgwtgwtbootstrap3

How to stop GWTBootstrap3 from refreshing and loosing my input and returning an error code


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) {


Solution

  • 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.