I'm not aware of an eval function exposed in GWT, but you should just
be able to create a JSNI function to do whatever you want in JS,
something like:

native String evalStuff(String javascript, String story)
/*-{
   return eval(javascript);
}-*/;

On Apr 1, 9:47 am, markww <[email protected]> wrote:
> Hi,
>
> I have two textareas set up:
>
>   [textarea1]  [textarea2]
>
> in textarea1, I enter some text from a story, like "Once upon a time".
> in textarea2, I enter some text I want to evaluate as javascript.
>
> when I hit a button, I want to grab the contents of textarea2, call
> eval() on it, which can modify the contents of textarea1. It'll do
> something like maybe make all the words in textarea1 all caps. Ideally
> something like:
>
>   public void onButtonClickedGo() {
>       String story = textarea1.getText();
>       String javascript = textarea2.getText();
>
>       String newStory = GWT.eval(javascript, story);
>       textarea1.setText(newStory);
>   }
>
> I know the above is wildly incorrect, just trying to illustrate what i
> want to do. I know eval is dangerous, this is just a tool I want to
> use for personal use. Is this possible? I'm not sure how to do this in
> GWT.
>
> Thanks

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