MDL-7778 fixed cancel button failing on some pages (I hope)

This commit is contained in:
skodak 2006-12-04 22:00:47 +00:00
parent f24a257d85
commit 1cbb09f1d1
2 changed files with 7 additions and 1 deletions

View 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)
{

View 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;