Tuesday, June 29, 2010

Re: Javascript in HTML Object works in FF not IE

The eval alternative that i mentioned will work only if your was
returning JavaScript, but in your case, looks like you are returning
HTML from the server.

Since it works in FF, i assume your server is returning something like
this:

<span id="tranDateTo" value="value"></span>
<span id="tranDateFrom" value="value"></span>

Of course the html tags can be diferent.

Maybe you could have this strange behavior because you don't added the
HTMLPanel to the DOM of the page. Maybe if you attach the
**htmlResponse** to some widget you could have it working in IE
(totaly hack, but maybe will work, who knowns :) ).

As an alternative, if possible, you could change your JSP to return
some valid XML and use the GWT Xml tools to extract the values from
your JSP or (the much more easier way) you could return some JSON and
use combined with native *eval* to extract the information that you
want.

On 29 jun, 17:31, skippy <a...@2lehmans.com> wrote:
> To make sure you are clear as to what I am doing.
>
>  public void onResponseReceived(Request request, Response response)
>                 {
>
>                     HTMLPanel htmlResponse = new
> HTMLPanel(response.getText());
>
>                     Element temp =
> htmlResponse.getElementById("tranDateFrom");
>                     if (null == temp) {
>                         //error encountered
>                         tranDateFrom = "";
>                         tranDateTo = "";
>                     } else {
>                         tranDateFrom =
> temp.getAttribute("value");
>                         temp =
> htmlResponse.getElementById("tranDateTo");
>                         tranDateTo = temp.getAttribute("value");
>                     }
>                     ScrollPanel scrollPanel = new
> ScrollPanel(htmlResponse);
>                     scrollPanel.setHeight("100%");
>                     scrollPanel.setWidth("100%");
>                     lowerPanel.add(scrollPanel);
>                     wait.hide();
>                     updateSectionHeading(tranDateFrom, tranDateTo,
> activityType);
>                 }
>             });
>
> On Jun 29, 3:23 pm, skippy <a...@2lehmans.com> wrote:
>
>
>
> > thanks for the reply.
>
> > I am getting HTML with <script language="JavaScript"> in the html for
> > onClick events.
> > Can you elaberate on eval?
>
> > I do not see setInnerHTML in a HTML or HTMLPanel or ScrolPannel.
>
> > after closer review, looks like I am setting the HTML in the
> > constructor of the HTMLPanel.
>
> > On Jun 29, 1:48 pm, André Moraes <andr...@gmail.com> wrote:
>
> > > How do you load the script?
>
> > > You add a script tag or download the javascript code and then make a
> > > call to eval?
>
> > > Another question, the information retreived by the requestbuilder is
> > > only javascript (json) or had html too? If your case is the second,
> > > you could use setInnerHTML.
>
> > > On 29 jun, 15:16, skippy <a...@2lehmans.com> wrote:
>
> > > > I have seen several postings about this, but have not seen a clear
> > > > answer.
>
> > > > I have some non compiled javascript that is loaded into an HTML object
> > > > by using a requestBuilder call to my legacy jsp application.
>
> > > > When clicking on a link in FF the javascript works fine.  However, not
> > > > is IE.
>
> > > > I have seem recommendations that the javascript needs to be in the
> > > > module HTML page.  This works, however, does not scale very well.
>
> > > > Two Questions:
>
> > > > 1) Why is this working in FF and not IE.  Some MAC browsers are also
> > > > OK.  I must be missing some basic concept.
>
> > > > 2) What is the correct approach to having onClicked/ onSelect events
> > > > in HTML access non compiled Javascript.
>
> > > > Thanks for your time.- Hide quoted text -
>
> > > - Show quoted text -- 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 google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment