[Seaside] Getting the selected text in a textArea

AxiNat tibabenfortlapalanca at gmail.com
Thu Feb 3 12:00:24 UTC 2011


Hi list,

I've been wrecking my brains all morning long trying to get to reference the
selected text in a textArea by using javascript or whatever means.

So long, I've found a couple of snippets that should do the job, for
example:

function getFocusedTextArea() {
  var textareas = document.getElementsByTagName(“textarea”);
  for(var i=0; i lessthan textareas.length; i++) {
    var ta = textareas.item(i);
    if (window.getComputedStyle(ta, null).zIndex == 57) {
      return ta;
    }
  }
}

The problem is that I don't know how to store the value returned by
getFocusedTextArea() into a variable inside a component. I'd like something
similar to:

html submitButton
   onClick: (html doSomethingMagicInJavascript:
       [aString := html andSomethingElseMagic: 'getFocusedTextArea();']);
   with: 'Get the selected text magically'.

Is there such thing?

Thanks!

Bernat Romagosa.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20110203/6d7baa16/attachment.htm


More information about the seaside mailing list