I'm trying to get the text entered by a user in an "input" field.  It
works in IE and in Hosted Mode, but not in Firefox or Chrome.  I'm
using DOM.getElementAttribute to read the text.  When it doesn't work,
all I get is an empty string.  I've made simple test case by modifying
the template code generated by the applicationCreator.  Below are the
code snippets.  Any ideas on how to get this to work?


.
.
.
final HTML inputHTML = new HTML("<input type=\"text\" id=\"input1\",
name=\"input1\">");
vPanel.add(inputHTML);
.
.
.
button.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
                String val = "NULL";
                try
                {
                        //com.google.gwt.user.client.Element elem =
DOM.getElementById("input1");
                        com.google.gwt.user.client.Element elem =
DOM.getChild(inputHTML.getElement(), 0);
                        if (elem != null)
                                val = DOM.getElementAttribute(elem, "value");
                }
                catch (Exception ex)
                {
                        val = "ERROR: " + ex.getMessage();
                }

          vPanel.add(new HTML("VALUE: " + val));
      }
    });
.
.
.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
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