hi,

This doesn't work for me. Myabe becasue I didn't explain how we show
the JSP. In the root panel we added a toolbar and a LayoutContainer
where, depending on the button clicked in toolbar, a different content
is shown. In some cases, inside the layoutContainer we place JSP using
a Frame. ex:

                  LayoutContainer mainPanel_;
                  mainPanel_ = new LayoutContainer();
                Frame frame_ = new Frame();
                frame_.getElement().setId("oldWebFrame");
                frame_.setUrl(urlToShow_); //loads JSP into frame
                mainPanel_.add(frame_);

After some research I have found that this code works for me:


        IFrameElement iframeElement =
(IFrameElement)Document.get().getElementById("oldWebFrame");
        Document document =iframeElement.getContentDocument();
        Element element = document.getElementById(fieldId);
        if (element != null) {
            TextAreaElement textfield = element.cast();
            textfield.setValue("some text to add");
        }

pep.


On Apr 4, 1:13 pm, Alexandre Ardhuin <[email protected]>
wrote:
> Hi,
>
> Are you sure the textarea contains the good id attribute ?
> Are you sure to enter the if statement ?
>
> You don't have to use JSNI to update the textarea. Use instead :
>
> Element element = Document.get().getElementById(fieldId);
> if (element != null) {
>     GWT.log("found element with id:" + fieldId);
>     TextAreaElement textfield = element.cast();
>     textfield.setValue(newValue);
>
> }
>
> Alexandre
>
> 2011/4/4 pepgrifell <[email protected]>
>
>
>
> > hi,
>
> > we are migrating our old website (based on JSP) to GWT. The
> > application is big and we cannot do all the changes at one, so in the
> > application there are some pages in GWT and some pages in JSP.
>
> > I have a JSP with some fields. One of them is a textarea. When I click
> > in it, a GWT window pops up with a list of values. When I click in one
> > of the values, I need to put the selected value in the textarea (JSP).
>
> > In GWT window, when selecting the value I call to native method (as
> > parameters,I pass the id of textarea field and the text to set to the
> > textarea.
>
> >  public native void updateOldWebField(String fieldId,String newValue) /
> > *-{
> >                    var textfield = $doc.getElementById(fieldId);
> >                    if (textfield!=null) {
> >                        textfield.value = newValue;
> >                    }
> >  }-*/;
>
> > But nothing is set into the textarea. Does I need to call
> > parent.document ? how I do that ?
>
> > Thanks,
> > pep
>
> > --
> > 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.- Hide quoted text -
>
> - Show quoted text -

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