I saw a faq that made the same recommendation.  The problem is, I need
to capture the onKeyUp and onClick events of the input's inside the
form.  I could only figure out how to "bind" to the form OR bind to
its children.  I couldn't figure out how to bind to both.  GWT threw a
variety of exceptions over the issue.  Could you show me some sample
code that does this?

On Nov 21, 2:18 pm, Reinier Zwitserloot <[EMAIL PROTECTED]> wrote:
> These features generally only work if the textbox and passwordbox are
> in the initial HTML.
>
> In GWT's normal modus operandi, the boxes are added dynamically by the
> javascript.
>
> The solution is to have the boxes in the static HTML file that
> bootstraps GWT (normally auto-generated by the applicationCreator), in
> a div that makes them hidden (use visibility and not display: none).
> From GWT, re-visibilize them if you need em. That should work.
>
> On Nov 21, 11:04 pm, tieTYT <[EMAIL PROTECTED]> wrote:
>
> > Hello,
>
> > I'm trying to replicate browser autocomplete on a login form.  For
> > example, every time you go to the login page, I'd like the username
> > and password field to be prepopulated with the username/password you
> > used last.  Not only that, but if you clear the username and double
> > click the field, the list of previous usernames you've entered should
> > show up.  If you select one, the password field gets populated with
> > that.
>
> > Fortunately, with normal HTML the browser handles all of this for
> > you.  But I can't figure out how to get this to work on IE6/7 on an
> > GWT app.  In these browsers, it doesn't offer to save the usernames.
> > I'll provide the code I have so far (this works in FF):
>
> > public class Sandbox implements EntryPoint, ClickListener,
> > KeyboardListener {
>
> >     private Label label;
> >     private FormPanel formPanel;
>
> >     /**
> >      * This is the entry point method.
> >      */
> >     public void onModuleLoad() {
>
> >         formPanel = new FormPanel();
> >         final VerticalPanel basePanel = new VerticalPanel();
> >         formPanel.add(basePanel);
>
> >         TextBox loginTB = new TextBox();
> >         //without this, FF doesn't know where to place the data
> >         loginTB.setName("name");
> >         basePanel.add(loginTB);
>
> >         PasswordTextBox passTB = new PasswordTextBox();
> >         //without this, FF doesn't know where to place the data
> >         passTB.setName("password");
> >         basePanel.add(passTB);
>
> >         Button loginBT = new Button("Submit");
> >         basePanel.add(loginBT);
>
> >         RootPanel.get("slot1").add(formPanel);
>
> >         loginTB.addKeyboardListener(this);
> >         passTB.addKeyboardListener(this);
> >         loginBT.addClickListener(this);
>
> >         label = new Label();
> >         RootPanel.get("slot2").add(label);
> >     }
>
> >     public void onClick(Widget sender) {
> >         //Without this, FF doesn't offer to remember the data
> >         formPanel.submit();
> >         if (label.getText().equals("")) {
> >             SandboxService.App.getInstance().getMessage("Hello,
> > World!", new MyAsyncCallback(label));
> >         } else
> >             label.setText("");
> >     }
>
> >     public void onKeyDown(Widget sender, char keyCode, int modifiers)
> > {
> >     }
>
> >     public void onKeyPress(Widget sender, char keyCode, int modifiers)
> > {
> >     }
>
> >     public void onKeyUp(Widget sender, char keyCode, int modifiers) {
> >         // If enter is pressed lets forward the request to onClick
> > method
> >         if (keyCode == '\r') {
> >             onClick(sender);
> >         }
> >     }
>
> >     static class MyAsyncCallback implements AsyncCallback {
> >         public void onSuccess(Object object) {
> >             DOM.setInnerHTML(label.getElement(), (String) object);
> >         }
>
> >         public void onFailure(Throwable throwable) {
> >             label.setText("Failed to receive answer from server!");
> >         }
>
> >         Label label;
>
> >         public MyAsyncCallback(Label label) {
> >             this.label = label;
> >         }
> >     }
>
> > }
--~--~---------~--~----~------------~-------~--~----~
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