Greetings,
-- I would like to have the browser save the username/password to my application. I have searched and searched and found no solution that works on all of the standard browsers (Chrome, IE, Firefox, Safari). Best I have been able to do (works on Firefox & IE) is:
....
<form id="login-form" action="login">
<table>
<tr>
<td><button type="button">Continue as a guest</button> or Login ID:</td>
<td> <input autocomplete="on" type="text" tabindex="0" name="username" id="username" placeholder=Email Address></td>
<td>(email address)</td>
</tr>
<tr>
<td align=right>Password:</td>
<td><input autocomplete="on" type="password" tabindex="0" name="password" id="password" placeholder=Password></td>
<td><button type="submit">Login</button></td>
</tr>
</table>
</form>
....
private static final String FORM_ID = "login-form";
private static final String USER_ID = "username";
private static final String PASSWORD_ID = "password";
private static void doLogin() {
Window.alert("test 1");
}
private static native void injectLoginFunction() /*-{
$wnd.login = function() {
@booklion.client.login.Login::doLogin()();
};
}-*/;
public void onModuleLoad() {
injectLoginFunction(); // ok
TextBox fUsername = TextBox.wrap(DOM.getElementById(USER_ID));
fUsername.setStyleName("gwt-TextBox");
PasswordTextBox fPassword = PasswordTextBox.wrap(DOM.getElementById(PASSWORD_ID));
fPassword.setStyleName("gwt-PasswordTextBox");
FormPanel fLoginForm = FormPanel.wrap(DOM.getElementById(FORM_ID), false);
fLoginForm.setAction(""); // ok
fLoginForm.addSubmitHandler(new FormPanel.SubmitHandler() {
@Override
public void onSubmit(FormPanel.SubmitEvent event) {
Window.alert("test 2");
}
});
fLoginForm.getElement().setAttribute("onsubmit", "login();return false;");
}
test 1 gets displayed - not test 2. Firefox and IE offer to save the password. Chrome and Safari do not.
Sure would appreciate some help.
Thanks.
Blake McBride
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment