MDL-30839 Fixing extra line breaks in error msg
authorJason Fowler <phalacee@gmail.com>
Wed, 21 Aug 2013 06:58:50 +0000 (14:58 +0800)
committerJason Fowler <phalacee@gmail.com>
Wed, 21 Aug 2013 06:58:50 +0000 (14:58 +0800)
lib/formslib.php

index 075bd80..80e9e0d 100644 (file)
@@ -2157,6 +2157,8 @@ function qf_errorHandler(element, _qfMsg) {
       && div.className != "error") {
         div.className += " error";
         linebreak = document.createElement("br");
       && div.className != "error") {
         div.className += " error";
         linebreak = document.createElement("br");
+        linebreak.className = "error";
+        linebreak.id = \'id_error_break_\'+element.name;
         errorSpan.parentNode.insertBefore(linebreak, errorSpan.nextSibling);
     }
 
         errorSpan.parentNode.insertBefore(linebreak, errorSpan.nextSibling);
     }
 
@@ -2166,6 +2168,10 @@ function qf_errorHandler(element, _qfMsg) {
     if (errorSpan) {
       errorSpan.parentNode.removeChild(errorSpan);
     }
     if (errorSpan) {
       errorSpan.parentNode.removeChild(errorSpan);
     }
+    var linebreak = document.getElementById(\'id_error_break_\'+element.name);
+    if (linebreak) {
+      linebreak.parentNode.removeChild(linebreak);
+    }
 
     if (div.className.substr(div.className.length - 6, 6) == " error") {
       div.className = div.className.substr(0, div.className.length - 6);
 
     if (div.className.substr(div.className.length - 6, 6) == " error") {
       div.className = div.className.substr(0, div.className.length - 6);