what I do is: have a hidden html-form in my html page:
    <div id="hiddenLoginDiv" style="display:none" >
        <form id="hiddenLoginForm"  method="post" action="dummy.html"
                        onsubmit="javascript:return false;">
                <input id="username" name="username" type="text" size="20"
maxlength="100" />
                <input id="password" name="password" type="password" size="20"
maxlength="100" />
                <input id="hiddenLoginFormSubmitButton" type="submit" />
        </form>
    </div>

in my entry-point I simply read those values and set them into my gwt-
text and gwt-password fields.
if the html values are empty, my gwt-fields will also be empty (this
is always the case when the user enters the site for the first time).
when the user then clicks my login-button:
 * I copy the values from my gwt-fields back to the html-fields in the
hidden form
 * then I call click on the hidden form's submit button (which will
NOT submit the form, see onsubmit())
   this triggers the browsers passwordmanager
 * then I proceed with my own login-routine on the server

NOTES:
 * I am not sure, that this will work in all browsers password
managers - I think some browsers require the form to really be
submitted
   anyway: it works well in firefox 3
 * 
http://code.google.com/docreader/#p=google-web-toolkit-incubator&s=google-web-toolkit-incubator&t=LoginSecurityFAQ
 * to trigger the form submit:
        /**
         * will trigger the submit action of the dummy login form for
password managers
         * the form will not be submitted, because the onSubmit function will
always return false.
         * note: calling form.submit() instead of calling button.click() will
not call the onSubmit
         *       function but submit the form immediately.
         */
        public static native void submitHiddenLoginForm() /*-{
                $doc.getElementById('hiddenLoginFormSubmitButton').click();
        }-*/;


On Jan 8, 12:28 pm, Ice13ill <[email protected]> wrote:
> I'm trying to remember the username and password in a gwt login
> applicaion.
> I found this:
> 1. adding a textbox and passwordbox in the html file
>
> <input type="text" id="1" name="text"/>
> <input type="password" id="2" name="password"/>
>
> (i read that if i add those in the html file, the browser will
> automatically remember the values).
>
> 2. DOM.getElementById for each of them
>
>                 m_tbUsername = TextBox.wrap(DOM.getElementById("1"));
>                 m_tbUsername.addKeyboardListener(this);
>
>                 m_tbPassword = PasswordTextBox.wrap(DOM.getElementById("2"));
>                 m_tbPassword.addKeyboardListener(this);
> I also added a Login button with a ClickListener
>
> Problem:
> neither of those above (textbox, passwordbox, button) will respond to
> key or click actions
>
> So...
> public void onClick(Widget sender) {
>                 Window.alert("b");}
>
> does nothing
>
> What's the problem ?
> Can somebody tell me another method in gwt for remembering username
> and password ? (a link or tip )
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to