Why does DOM.getElementById() return null while $doc.getElementById()
in a JNSI method return a value?

I'm trying to add a logon form to my welcom-file HTML (as mentioned in
http://code.google.com/p/google-web-toolkit-incubator/wiki/LoginSecurityFAQ).
The username looks like
<input class="gwt-TextBox" type="text" id="username" />, and is
<div>A.  The invoking button is written in GWT so that it may call my
logon RPC.  My application is loaded in <div>B.

In the button's ClickHandler, if I request
String name = DOM.getElementById("username").getNodeValue(), the
element is null, not found.  However if I request tring name =
getUsername(); where getUsername() is
        private native String getUsername()  /*-{
                 return $doc.getElementById('username').value;
        }-*/;
the value of the username field is returned.

Why is the document different from one to the other?  Can I get the
username without JNSI?
--~--~---------~--~----~------------~-------~--~----~
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