diff --git a/lib/form/editor.php b/lib/form/editor.php index 6e1f12a2647..fa2737c2dd7 100644 --- a/lib/form/editor.php +++ b/lib/form/editor.php @@ -204,7 +204,12 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element { $rows = empty($this->_attributes['rows']) ? 15 : $this->_attributes['rows']; $cols = empty($this->_attributes['cols']) ? 80 : $this->_attributes['cols']; - $str .= '
'; diff --git a/lib/formslib.php b/lib/formslib.php index b07f3e6b8ca..79b1b36f44f 100644 --- a/lib/formslib.php +++ b/lib/formslib.php @@ -1705,6 +1705,9 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless { } // Fix for bug displaying errors for elements in a group //$test[$elementName][] = $registry->getValidationScript($element, $elementName, $rule); + if ($element->_type == 'editor') { + $elementName .= '[text]'; + } $test[$elementName][0][] = $registry->getValidationScript($element, $elementName, $rule); $test[$elementName][1]=$element; //end of fix @@ -1777,6 +1780,13 @@ function qf_errorHandler(element, _qfMsg) { '/[_\[\]]/', create_function('$matches', 'return sprintf("_%2x",ord($matches[0]));'), $elementName); + if ($element->_type == 'editor') { + $tinyjs = " + if (tinyMCE.get('id_{$element->getName()}')) { + tinyMCE.get('id_{$element->getName()}').save(); + }"; + array_unshift($jsArr, $tinyjs); + } $js .= ' function validate_' . $this->_formName . '_' . $escapedElementName . '(element) { if (undefined == element) {