diff --git a/lib/editor/htmlarea/htmlarea.php b/lib/editor/htmlarea/htmlarea.php
index 20827714064..c6a29080120 100644
--- a/lib/editor/htmlarea/htmlarea.php
+++ b/lib/editor/htmlarea/htmlarea.php
@@ -634,12 +634,14 @@ HTMLArea.prototype.generate = function () {
}
// Moodle hack end.
var a = this.__msh_prevOnSubmit;
+ var ret = true;
// call previous submit methods if they were there.
if (typeof a != "undefined") {
for (var i = a.length; --i >= 0;) {
- a[i]();
+ ret = a[i]() && ret;
}
}
+ return ret;
};
if (typeof f.onreset == "function") {
var funcref = f.onreset;
diff --git a/lib/formslib.php b/lib/formslib.php
index 57a7a5cf333..0bdbcc01170 100644
--- a/lib/formslib.php
+++ b/lib/formslib.php
@@ -810,12 +810,16 @@ function validate_' . $this->_attributes['id'] . '_' . $elementName . '(element)
$element->updateAttributes(array('onBlur' => $onBlur . $valFunc,
'onChange' => $onChange . $valFunc));
}
+// do not rely on frm function parameter, because htmlarea breaks it when overloading the onsubmit method
$js .= '
function validate_' . $this->_attributes['id'] . '(frm) {
if (skipClientValidation) {
return true;
}
var ret = true;
+
+ var frm = document.getElementById(\''. $this->_attributes['id'] .'\')
+
' . $validateJS . ';
return ret;
}
diff --git a/lib/weblib.php b/lib/weblib.php
index 8f755acb5e1..e14fcb7e979 100644
--- a/lib/weblib.php
+++ b/lib/weblib.php
@@ -3578,7 +3578,7 @@ function print_textarea($usehtmleditor, $rows, $cols, $width, $height, $name, $v
}
}
}
- $str .= '