Basic JavaScript onClick not getting called from inside GWT richTextarea

68 views
Skip to first unread message

gangurg gangurg

unread,
Nov 7, 2011, 4:58:55 PM11/7/11
to Google-We...@googlegroups.com

The following code works fine if i do HTML = new HTML("<a href=# onclick=window.test()>Hi 123I</a>'); ( Meaning HelloWorld gets Printed )
But the same HTML from inside a RichTextArea does not get printed . 

I am doing missing something here 



MyPanel 
{

     RichTextArea ss = new RichTextArea ();
     ss.stHTML("<a href=# onclick=window.test()>Hi 123I</a>");

      public static native void exportMyFunction2(MyPanel x) /*-{
    $wnd.call = function () {
   x.@myPackage.MyPanel::test()();
   }
      
}-*/;


   public void test()
{
GWT.log("Hello World");
}
   

}

gangurg gangurg

unread,
Nov 7, 2011, 10:55:55 PM11/7/11
to Google-We...@googlegroups.com
Folks just a small type in the post , I do window.call instead of window.test(). Still have the same issue . Any thoughts . 

Danny Kirchmeier

unread,
Nov 7, 2011, 11:48:37 PM11/7/11
to google-we...@googlegroups.com, Google-We...@googlegroups.com
Did you ever call exportMyFunction2?

gangurg gangurg

unread,
Nov 7, 2011, 11:55:47 PM11/7/11
to google-we...@googlegroups.com

Yes i Did .  As i posted , earlier this works from a standalone HTML . if this is embedded inside the RichTextArea then onClick is not getting fired . 
I am thinking it could be because of the Iframe 



On Mon, Nov 7, 2011 at 8:48 PM, Danny Kirchmeier <da...@kirchmeier.us> wrote:
Did you ever call exportMyFunction2?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/t3GfHd8ZwxsJ.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

gangurg gangurg

unread,
Nov 9, 2011, 11:29:57 AM11/9/11
to Google-We...@googlegroups.com
Any thoughts ?

On Mon, Nov 7, 2011 at 1:58 PM, gangurg gangurg <gan...@gmail.com> wrote:

Danny Kirchmeier

unread,
Nov 9, 2011, 12:09:30 PM11/9/11
to google-we...@googlegroups.com, Google-We...@googlegroups.com
No idea. Seems to me that you should be using an Anchor and ClickHandlers instead of that native method, but I may not understand exactly why you need that.

gangurg gangurg

unread,
Nov 9, 2011, 5:11:33 PM11/9/11
to google-we...@googlegroups.com
Its not possible to use Anchor and ClickHandlers inside RichTextArea directly . I could convert the anchor to element , but again events would not get intercepted . 



On Wed, Nov 9, 2011 at 9:09 AM, Danny Kirchmeier <da...@kirchmeier.us> wrote:
No idea. Seems to me that you should be using an Anchor and ClickHandlers instead of that native method, but I may not understand exactly why you need that.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
Reply all
Reply to author
Forward
0 new messages