Skip to content

Commit

Permalink
Merge branch 'MDL-27045_21' of git://github.com/timhunt/moodle into M…
Browse files Browse the repository at this point in the history
…OODLE_21_STABLE
  • Loading branch information
stronk7 committed Nov 23, 2011
2 parents f99bd07 + 0f8e22e commit 4df0583
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
20 changes: 20 additions & 0 deletions lib/form/form.js
Expand Up @@ -237,6 +237,10 @@ M.form.initFormDependencies = function(Y, formid, dependencies) {
_dependency_notchecked : function(elements, value) { _dependency_notchecked : function(elements, value) {
var lock = false; var lock = false;
elements.each(function(){ elements.each(function(){
if (this.getAttribute('type').toLowerCase()=='hidden' && Y.Node.getDOMNode(this).ancestor('div.felement.fcheckbox')) {
// This is the hidden input that is part of an advcheckbox.
return;
}
if (this.getAttribute('type').toLowerCase()=='radio' && this.get('value') != value) { if (this.getAttribute('type').toLowerCase()=='radio' && this.get('value') != value) {
return; return;
} }
Expand All @@ -250,6 +254,10 @@ M.form.initFormDependencies = function(Y, formid, dependencies) {
_dependency_checked : function(elements, value) { _dependency_checked : function(elements, value) {
var lock = false; var lock = false;
elements.each(function(){ elements.each(function(){
if (this.getAttribute('type').toLowerCase()=='hidden' && Y.Node.getDOMNode(this).ancestor('div.felement.fcheckbox')) {
// This is the hidden input that is part of an advcheckbox.
return;
}
if (this.getAttribute('type').toLowerCase()=='radio' && this.get('value') != value) { if (this.getAttribute('type').toLowerCase()=='radio' && this.get('value') != value) {
return; return;
} }
Expand All @@ -272,10 +280,16 @@ M.form.initFormDependencies = function(Y, formid, dependencies) {
}, },
_dependency_eq : function(elements, value) { _dependency_eq : function(elements, value) {
var lock = false; var lock = false;
var hidden_val = false;
elements.each(function(){ elements.each(function(){
if (this.getAttribute('type').toLowerCase()=='radio' && !Y.Node.getDOMNode(this).checked) { if (this.getAttribute('type').toLowerCase()=='radio' && !Y.Node.getDOMNode(this).checked) {
return; return;
} else if (this.getAttribute('type').toLowerCase() == 'hidden' && Y.Node.getDOMNode(this).ancestor('div.felement.fcheckbox')) {
// This is the hidden input that is part of an advcheckbox.
hidden_val = (this.get('value') == value);
return;
} else if (this.getAttribute('type').toLowerCase() == 'checkbox' && !Y.Node.getDOMNode(this).checked) { } else if (this.getAttribute('type').toLowerCase() == 'checkbox' && !Y.Node.getDOMNode(this).checked) {
lock = lock || hidden_val;
return; return;
} }
//check for filepicker status //check for filepicker status
Expand Down Expand Up @@ -303,10 +317,16 @@ M.form.initFormDependencies = function(Y, formid, dependencies) {
}, },
_dependency_default : function(elements, value, ev) { _dependency_default : function(elements, value, ev) {
var lock = false; var lock = false;
var hidden_val = false;
elements.each(function(){ elements.each(function(){
if (this.getAttribute('type').toLowerCase()=='radio' && !Y.Node.getDOMNode(this).checked) { if (this.getAttribute('type').toLowerCase()=='radio' && !Y.Node.getDOMNode(this).checked) {
return; return;
} else if (this.getAttribute('type').toLowerCase() == 'hidden' && Y.Node.getDOMNode(this).ancestor('div.felement.fcheckbox')) {
// This is the hidden input that is part of an advcheckbox.
hidden_val = (this.get('value') != value);
return;
} else if (this.getAttribute('type').toLowerCase() == 'checkbox' && !Y.Node.getDOMNode(this).checked) { } else if (this.getAttribute('type').toLowerCase() == 'checkbox' && !Y.Node.getDOMNode(this).checked) {
lock = lock || hidden_val;
return; return;
} }
//check for filepicker status //check for filepicker status
Expand Down
6 changes: 5 additions & 1 deletion lib/formslib.php
Expand Up @@ -1963,7 +1963,11 @@ function _getElNamesRecursive($element) {
} else if (is_a($element, 'HTML_QuickForm_hidden')) { } else if (is_a($element, 'HTML_QuickForm_hidden')) {
return array(); return array();


} else if (method_exists($element, 'getPrivateName')) { } else if (method_exists($element, 'getPrivateName') &&
!($element instanceof HTML_QuickForm_advcheckbox)) {
// The advcheckbox element implements a method called getPrivateName,
// but in a way that is not compatible with the generic API, so we
// have to explicitly exclude it.
return array($element->getPrivateName()); return array($element->getPrivateName());


} else { } else {
Expand Down

0 comments on commit 4df0583

Please sign in to comment.