[Tickets #692] NEW: HTMLArea cannot find the correct TEXTAREA

bugs at bugs.horde.org bugs at bugs.horde.org
Thu Oct 14 02:23:59 PDT 2004


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/?id=692
-----------------------------------------------------------------------
 Ticket     | 692
 Created By | ctnpublic-horde at yahoo.com
 Summary    | HTMLArea cannot find the correct TEXTAREA
 Queue      | Horde Framework
 State      | Unconfirmed
 Priority   | 2. Medium
 Type       | Bug
 Owners     | 
-----------------------------------------------------------------------


ctnpublic-horde at yahoo.com (2004-10-14 02:23) wrote:

Due to a "feature" in IE ( http://my.opera.com/hallvors/archives/6 ),
getElementByID() matches either the name or the id attribute. There are two
elements on the compose page with the name "message".

HTMLArea 3.x has an API (HTMLArea.replace(id, config)) to handle this.
Suggest using it as follows:

cvs diff -u -r HEAD framework/Editor/Editor/htmlarea.php
Index: framework/Editor/Editor/htmlarea.php
===================================================================
RCS file: /repository/framework/Editor/Editor/htmlarea.php,v
retrieving revision 1.21
diff -u -r1.21 htmlarea.php
--- framework/Editor/Editor/htmlarea.php        6 Sep 2004 15:01:28 -0000   
  1.21
+++ framework/Editor/Editor/htmlarea.php        14 Oct 2004 09:23:18 -0000
@@ -54,16 +54,18 @@
                'config.debug = false; ' .
                'config.hideSomeButtons(" showhelp "); ';

+
         if (isset($params['id'])) {
-            $js .= 'var textareas = [document.getElementById("' .
$params['id'] . '")]; ';
-        } else {
-            $js .= 'var textareas =
document.getElementsByTagName("textarea"); ';
-        }
-        $js .= 'for (var i = textareas.length - 1; i >= 0; i--) { ' .
-               'var editor = new HTMLArea(textareas[i], config); ' .
-               $plugins .
-               'editor.generate()}}; ' .
-               'HTMLArea.init();';
+
+           $js .= 'var ta = HTMLArea.getElementById("textarea", "' .
$params['id'] . '"); ' .
+                  'HTMLArea.replace("' . $params['id'] . '", config); ';
+
+       } else {
+            $js .= 'HTMLArea.replaceAll(config); ';
+       }
+
+       $js .= '}; ' .
+              'HTMLArea.init();';

         $notification->push($js, 'javascript');
     }





More information about the bugs mailing list