On Sep 1, 6:30 pm, Thomas Broyer <[email protected]> wrote:
> On 2 sep, 00:16, Thad <[email protected]> wrote:
>
> > Using Document.get().getElementById() returns an element, but it has
> > no value:
>
> > Element el = Document.get().getElementById("username");
> > if (el != null)
> > GWT.log("element: "+el.getNodeValue(), null);
>
> > prints only "element: " in the console.
>
> Try el.<InputElement>cast().getValue() instead; getNodeValue() is a
> "generic" DOM method that cannot be aware of the ".value" property
> specific to InputElement's.
Thanks. This works:
String name = ((InputElement)Document.get().getElementById
("username")).getValue();
Using a native function was no big deal, but this code seems cleaner.
> > Right now I'm having bigger problems trying to do things
> > byhttp://code.google.com/p/google-web-toolkit-incubator/wiki/LoginSecur...
> > --
> > When the logon is successful, I hide the logon RootPanel <div>, show
> > the application RootPanel <div>, and add my widget to the application
> > <div>. This works fine in Firefox and Safari, but in IE7, I get a
> > blank browser. The application <div> never shows.
>
> Any JS error? does it work in hosted mode?
>
> > Whoever wrote the LoginSecurityFAQ, it's time "TODO: Expand on this
> > section" on the auto-complete section. :)
>
> From the comments on that
> page:http://groups.google.fr/group/Google-Web-Toolkit/t/2b2ce0b6aaa82461
I've followed the link above. What I have works excellently in hosted
mode, as well as in Firefox 3.5, and Safari 4--the browser's password
manager is triggered, and the user is logged in. However I've still
no luck with IE7 (and no Javascript error indicated).
Does IE have a problem with hiding/showing DIV's? The form behaves
properly. injectLoginFunction() works (see below), the doLogin()
method is called, and the user logged in (so says my server's
console). As you see below, on a successful login, the LOGIN_DIV in
the original panel is hidden, the APPLICATION_DIV is made visible, and
the application's MainWindowWidget is created and added to the
APPLICATION_DIV. (After a user logs off the server, the showLoginDiv
() method is called, and we start over.)
As I said, this works in hosted mode, Firefox 3.5, and Safari 4. In
IE, after the login completes, all I see is a blank browser, and
"Done" in the lower left message area (no JS error).
Is there another way to handle this that will work with IE?
private static native void injectLoginFunction() /*-{
$wnd.__gwt_login = function() {
@com.mycorp.web.client.Workstation::doLogin()();
};
}-*/;
@SuppressWarnings("unused")
private static void doLogin() {
final RootPanel applPanel = RootPanel.get
(Workstation.APPLICATION_DIV);
final RootPanel logonPanel = RootPanel.get(Workstation.LOGIN_DIV);
AsyncCallback<LoginInfo> callback = new AsyncCallback<LoginInfo>() {
public void onSuccess(LoginInformation result) {
Workstation.setLoginInfo(result);
logonPanel.setVisible(false);
applPanel.setVisible(true);
MainWindowWidget mw = new MainWindowWidget();
applPanel.add(mw);
}
public void onFailure(Throwable caught) {
if
(caught.getMessage().contains("java.net.ConnectException"))
Window.alert("Cannot connect to server.\n"+
"Server name or RPC number
invalid.");
else
Window.alert(caught.getMessage());
}
};
String name = ((InputElement)Document.get().getElementById
("username")).getValue();
String pw = ((InputElement)Document.get().getElementById
("password")).getValue();
String svr = ((InputElement)Document.get().getElementById
("server")).getValue();
ClientInfo ci = new ClientInfo();
LiloServicesAsync service = (LiloServicesAsync) GWT.create
(LiloServices.class);
service.doLogin(name, pw, svr, ci, callback);
}
public static void showLoginDiv() {
RootPanel applPanel = RootPanel.get(Workstation.APPLICATION_DIV);
applPanel.clear();
applPanel.setVisible(false);
RootPanel logonPanel = RootPanel.get(Workstation.LOGIN_DIV);
logonPanel.setVisible(true);
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---