Sunday, August 29, 2010

problems with auto-complete form login


I implemented a login form suitable for auto-complete by the browser
nearly exactly as described here:

Unfortunately, I have problems with it:

1. The password field is not filled in.

When I login for the first time the browser (FF) asks me to remember
the form fields. I can verify in the browsers settings that the
username and password is stored in the browser.

However, when I login again, only the username field is autofilled.
The password field is empty.

2. I cannot repeat the login.

When I login, logout and then try to login again, the form cannot be
created. The call to Document.get().getElementById(LOGINFORM_ID);
returns null.

I would be glad if someone could help me with this problem!

Below is my code.

Thank you


<!doctype html>
<!-- The DOCTYPE declaration above will set the -->
<!-- browser's rendering engine into -->
<!-- "Standards Mode". Replacing this declaration -->
<!-- with a "Quirks Mode" doctype may lead to some -->
<!-- differences in layout. -->

<meta http-equiv="content-type" content="text/html;

<!-- Consider inlining CSS to reduce the number of requested files
<link type="text/css" rel="stylesheet" href="ics.css">

<!-- -->
<!-- Any title is fine -->
<!-- -->
<title>Isar Chess System</title>

<!-- -->
<!-- This script loads your compiled module. -->
<!-- If you add any GWT meta tags, they must -->
<!-- be added before this line. -->
<!-- -->
<script type="text/javascript" language="javascript" src="ics/

<!-- -->
<!-- The body can have arbitrary html, or -->
<!-- you can leave the body empty if you want -->
<!-- to create a completely dynamic UI. -->
<!-- -->

<!-- OPTIONAL: include this if you want history support -->
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1'

<!-- RECOMMENDED if your web app will not function without
JavaScript enabled -->
<div style="width: 22em; position: absolute; left: 50%; margin-
left: -11em; color: red; background-color: white; border: 1px solid
red; padding: 4px; font-family: sans-serif">
Your web browser must have JavaScript enabled
in order for this application to display correctly.

  <div class="apl-Indicator" id="apl-Indicator">
    <img src="img/Indicator.gif"  alt="loading">

<div id="loginDiv" style="display:none">
<form action="login" id="loginForm">
<table id="loginTable" valign="center">
<td id="loginLabel">Username:</td>
<td><input id="loginUsername" name="u" style="margin-top: 0px"></
<td id="loginLabel">Password:</td>
<td><input id="loginPassword" name="pw" type="password"
style="margin: 0px"></td>
<td id="loginRememberMe"></td>
<td align='right'>
<button id="loginSubmit" type="submit">Login</button>




import ics.client.Application;
import ics.client.apl.Command;
import ics.client.gui.cmp.*;


public class LoginBox extends Box
private static final String LOGINFORM_ID = "loginForm";
private static final String LOGINBUTTON_ID = "loginSubmit";
private static final String REMEMBERME_ID = "loginRememberMe";
private static final String USERNAME_ID = "loginUsername";
private static final String PASSWORD_ID = "loginPassword";

public LoginBox ()
build ();

public void build ()
Element e = Document.get().getElementById(LOGINFORM_ID);
Window.alert ("LoginBox - Element: " + e);

assert (e != null);

FormPanel form = FormPanel.wrap(e, false);


TableCellElement rememberMeCell = (TableCellElement)
CheckBox box = new CheckBox("Remember Me");


VerticalPanel p = new VerticalPanel ();

private native void injectLoginFunction(LoginBox view)
$wnd.__gwt_login = function()

private void doLogin()
String usr = ((InputElement)
String pwd = ((InputElement)

execute (usr,pwd);

private void execute (String usr,String pwd)
// process login


You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment