Thanks.  getElementProperty is what I needed.

The input was created this way to better show the situation.  The GWT
components are part of a web page that has other (non-GWT) JavaScripts
running in it.  The other JavaScripts are writting to an input field.
The user can also enter data in these fields.  I was trying to get the
GWT scripts to read this data.

Thanks again.


On Sep 16, 8:21 am, Thomas Broyer <[EMAIL PROTECTED]> wrote:
> On 15 sep, 22:20, WebDude <[EMAIL PROTECTED]> wrote:
>
> > 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?
>
> You obviously want to value *property*, not the value *attribute* (in
> IE, getAttribute(attrName) returns the DOM property)
>
> > final HTML inputHTML = new HTML("<input type=\"text\" id=\"input1\",
> > name=\"input1\">");
> > vPanel.add(inputHTML);
>
> Same remark as Danny... I guess you have your reasons for creating
> inputs this way.
>
> > 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");
>
> val = DOM.getElementProperty(elem, "value");

--~--~---------~--~----~------------~-------~--~----~
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