While integrating Xinha into the Bricolage content management system, I came across an error when multiple Xinhas are on one page. The problem comes up in Xinha's onsubmit() method, which, when there are multiple Xinhas, is called multiple times. The subsequent calls fail because
this.__msh_prevOnSubmit is undefined, so "a" has no properties, and calling "a.length" causes a fatal error.
Patch:
Index: htmlarea.js
===================================================================
--- htmlarea.js (revision 52)
+++ htmlarea.js (working copy)
@@ -1053,16 +1053,19 @@
editor._textArea.value = editor.outwardHtml(editor.getHTML());
var a = this.__msh_prevOnSubmit;
// call previous submit methods if they were there.
- var allOK = true;
- for (var i = a.length; --i >= 0;)
+ if (typeof a != "undefined")
{
- if(a[i]() == false)
+ var allOK = true;
+ for (var i = a.length; --i >= 0;)
{
- allOK = false;
- break;
+ if(a[i]() == false)
+ {
+ allOK = false;
+ break;
+ }
}
+ return allOK;
}
- return allOK;
};
if (typeof f.onreset == "function") {
var funcref = f.onreset;
While integrating Xinha into the Bricolage content management system, I came across an error when multiple Xinhas are on one page. The problem comes up in Xinha's onsubmit() method, which, when there are multiple Xinhas, is called multiple times. The subsequent calls fail because
this.__msh_prevOnSubmit
is undefined, so "a" has no properties, and calling "a.length" causes a fatal error.Patch:
Reported by marshall
@exclupen.com, migrated from http://trac.xinha.org/ticket/100