]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-7778 fixed cancel button failing on some pages (I hope)
authorskodak <skodak>
Mon, 4 Dec 2006 22:00:47 +0000 (22:00 +0000)
committerskodak <skodak>
Mon, 4 Dec 2006 22:00:47 +0000 (22:00 +0000)
lib/form/cancel.php
lib/formslib.php

index d8e4876d777436aaa743d21f6adadea62748113b..88ca84e3abd10c1317bd39743779c41fe52213e9 100644 (file)
@@ -27,7 +27,7 @@ class MoodleQuickForm_cancel extends HTML_QuickForm_submit
             $value=get_string('cancel');
         }
         HTML_QuickForm_submit::HTML_QuickForm_submit($elementName, $value, $attributes);
-        $this->updateAttributes(array('onclick'=>'return this.form.submit();'));
+        $this->updateAttributes(array('onclick'=>'skipClientValidation = true; return true;'));
     } //end constructor
     function onQuickFormEvent($event, $arg, &$caller)
     {
index 0947dc64a5c8f3680fba12ca6569aac06a8ed3da..57a7a5cf3331a3b937fefe1822d1ec3b3a471b43 100644 (file)
@@ -733,6 +733,9 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless {
         $js = '
 <script type="text/javascript">
 //<![CDATA[
+
+var skipClientValidation = false;
+
 function qf_errorHandler(element, _qfMsg) {
   div = element.parentNode;
   if (_qfMsg != \'\') {
@@ -809,6 +812,9 @@ function validate_' . $this->_attributes['id'] . '_' . $elementName . '(element)
         }
         $js .= '
 function validate_' . $this->_attributes['id'] . '(frm) {
+  if (skipClientValidation) {
+     return true;
+  }
   var ret = true;
 ' . $validateJS . ';
   return ret;