[Zope] JavaScript help!

2000-08-13 Thread Peter Be

Maybe not a Zope specific question but the problem arises only with Zope
DTML.

The documentEdit.dtml page in OFS has this little HTML:
TEXTAREA NAME="data:text" WRAP="Off"
COLS="50"
ROWS="20"/TEXTAREA

And what I want to do is trigger a JavaScript that replaces specific
characters in the textarea box to others.
I.e. Replace swedish ö with HTML: ouml;

The problem is the name of the textarea box!
It is called "name:text"
If I replace the name of the textarea box to say "data", then my JavaScript
works fine.
I have tried to "eval" the box, but to no effect.
Any ideas??

--
Here's the JavaScript source:
script language="JavaScript1.2"
!--
// function changeChars()
// replace swedish chars with HTML ones.

function changeChars() {
 var box = eval("document.manage_edit_form.data:text");
 var datatext = box.value;
var newdatatext;
 newdatatext = datatext.replace("å","aring;");
 newdatatext = newdatatext.replace("Å","Aring;");
 newdatatext = newdatatext.replace("ä","auml;");
 newdatatext = newdatatext.replace("Ä","Auml;");
 newdatatext = newdatatext.replace("ö","ouml;");
 newdatatext = newdatatext.replace("Ö","Ouml;");

 box.value = newdatatext;
}
 --
/script


---
Here's the JavaScript error:
invalid label.

document.manage_edit_form.data:text
..^



___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] JavaScript help!

2000-08-13 Thread Evan Simpson

 function changeChars() {
  var box = eval("document.manage_edit_form.data:text");

This should be:

var box = document.manage_edit_form['data:text'];

JavaScript, like DTML, lets you access objects with funny names using
subscript notation.

Cheers,

Evan @ 4-am  digicool


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )