MDL-28737 advcheckboxes toggle state every submit if checkbox_controller present.

This commit is contained in:
Tim Hunt
2011-08-12 19:15:18 +01:00
parent 9d228de05a
commit 41977bb4cc
+1 -10
View File
@@ -980,15 +980,6 @@ abstract class moodleform {
$mform->setType("checkbox_controller$groupid", PARAM_INT);
$mform->setConstants(array("checkbox_controller$groupid" => $new_select_value));
// Locate all checkboxes for this group and set their value, IF the optional param was given
if (!is_null($select_value)) {
foreach ($this->_form->_elements as $element) {
if ($element->getAttribute('class') == "checkboxgroup$groupid") {
$mform->setConstants(array($element->getAttribute('name') => $select_value));
}
}
}
$checkbox_controller_name = 'nosubmit_checkbox_controller' . $groupid;
$mform->registerNoSubmitButton($checkbox_controller_name);
@@ -997,7 +988,7 @@ abstract class moodleform {
if (!defined('HTML_QUICKFORM_CHECKBOXCONTROLLER_EXISTS')) {
$js .= <<<EOS
function html_quickform_toggle_checkboxes(group) {
var checkboxes = getElementsByClassName(document, 'input', 'checkboxgroup' + group);
var checkboxes = document.getElementsByClassName('checkboxgroup' + group);
var newvalue = false;
var global = eval('html_quickform_checkboxgroup' + group + ';');
if (global == 1) {