6.0.0-beta1
7/23/25

[#692] HTMLArea cannot find the correct TEXTAREA
Summary HTMLArea cannot find the correct TEXTAREA
Queue Horde Framework Packages
Type Bug
State Resolved
Priority 2. Medium
Owners jan (at) horde (dot) org
Requester ctnpublic-horde (at) yahoo (dot) com
Created 10/14/2004 (7587 days ago)
Due
Updated 11/13/2004 (7557 days ago)
Assigned 10/14/2004 (7587 days ago)
Resolved 11/13/2004 (7557 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
11/13/2004 10:27:13 AM Jan Schneider Comment #6
State ⇒ Resolved
Reply to this comment
I don't commit this solution, because it assumes that you always want 
the first element with that name to become the HTMLArea. We should 
instead fix pages that have ambiguous form field names, like I did in 
IMP's compose windows, see bug 793.
11/12/2004 06:27:29 PM marc (at) r4l (dot) com Comment #5 Reply to this comment
The patch provided earlier in this bug report works beautifully... I 
would vote for it to be checked in, it solves bug #692 && #793.



Thanks.
10/14/2004 11:33:00 AM Jan Schneider Comment #4
State ⇒ Assigned
Reply to this comment
It would make more sense to not use the editor during spell checking. 
As a side effect this would avoid loading not needed script files.
10/14/2004 11:08:30 AM ctnpublic-horde (at) yahoo (dot) com Comment #3 Reply to this comment
Quite right, how careless of me (plugins).



imp/templates/compose/compose.inc has the <input name="message"> when 
spelling is turned on. This breaks HTML compose in IE.



Here's another workaround suggestion: find the exact TEXTAREA with the 
ID we want.



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 11:03:51 -0000

@@ -55,7 +55,13 @@

                 'config.hideSomeButtons(" showhelp "); ';



          if (isset($params['id'])) {

-            $js .= 'var textareas = [document.getElementById("' . 
$params['id'] . '")]; ';

+            $js .= 'var alltextareas = 
document.getElementsByTagName("textarea"); ' .

+                  'var textarea = null; ' .

+                  'for (tai = 0; tai < alltextareas.length; tai++) { ' .

+                  '    textarea = alltextareas[tai]; ' .

+                   '    if (textarea.id == "' . $params['id'] . '") 
break; ' .

+                  '} ' .

+                  'var textareas = [textarea]; ';

          } else {

              $js .= 'var textareas = 
document.getElementsByTagName("textarea"); ';

          }


10/14/2004 09:40:37 AM Jan Schneider Comment #2
Assigned to Jan Schneider
State ⇒ Feedback
Reply to this comment
Your patch breaks plugins support.



What elements did have a "message" id resp. name?
10/14/2004 09:23:58 AM ctnpublic-horde (at) yahoo (dot) com Comment #1
State ⇒ Unconfirmed
Priority ⇒ 2. Medium
Type ⇒ Bug
Summary ⇒ HTMLArea cannot find the correct TEXTAREA
Queue ⇒ Horde Framework Packages
Reply to this comment
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');

      }


Saved Queries