From 221b8fd72b521f858bbc71b95298b53278ba173c Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Thu, 8 Dec 2011 14:36:39 +0000 Subject: [PATCH] MDL-30658 formslib: fix JavaScript regression from MDL-27045. --- lib/form/form.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/form/form.js b/lib/form/form.js index e2f743e2a8a..938fab6be66 100644 --- a/lib/form/form.js +++ b/lib/form/form.js @@ -237,7 +237,7 @@ M.form.initFormDependencies = function(Y, formid, dependencies) { _dependency_notchecked : function(elements, value) { var lock = false; elements.each(function(){ - if (this.getAttribute('type').toLowerCase()=='hidden' && Y.Node.getDOMNode(this).ancestor('div.felement.fcheckbox')) { + if (this.getAttribute('type').toLowerCase()=='hidden' && !this.siblings('input[type=checkbox][name="' + this.get('name') + '"]').isEmpty()) { // This is the hidden input that is part of an advcheckbox. return; } @@ -254,7 +254,7 @@ M.form.initFormDependencies = function(Y, formid, dependencies) { _dependency_checked : function(elements, value) { var lock = false; elements.each(function(){ - if (this.getAttribute('type').toLowerCase()=='hidden' && Y.Node.getDOMNode(this).ancestor('div.felement.fcheckbox')) { + if (this.getAttribute('type').toLowerCase()=='hidden' && !this.siblings('input[type=checkbox][name="' + this.get('name') + '"]').isEmpty()) { // This is the hidden input that is part of an advcheckbox. return; } @@ -284,7 +284,7 @@ M.form.initFormDependencies = function(Y, formid, dependencies) { elements.each(function(){ if (this.getAttribute('type').toLowerCase()=='radio' && !Y.Node.getDOMNode(this).checked) { return; - } else if (this.getAttribute('type').toLowerCase() == 'hidden' && Y.Node.getDOMNode(this).ancestor('div.felement.fcheckbox')) { + } else if (this.getAttribute('type').toLowerCase() == 'hidden' && !this.siblings('input[type=checkbox][name="' + this.get('name') + '"]').isEmpty()) { // This is the hidden input that is part of an advcheckbox. hidden_val = (this.get('value') == value); return; @@ -321,7 +321,7 @@ M.form.initFormDependencies = function(Y, formid, dependencies) { elements.each(function(){ if (this.getAttribute('type').toLowerCase()=='radio' && !Y.Node.getDOMNode(this).checked) { return; - } else if (this.getAttribute('type').toLowerCase() == 'hidden' && Y.Node.getDOMNode(this).ancestor('div.felement.fcheckbox')) { + } else if (this.getAttribute('type').toLowerCase() == 'hidden' && !this.siblings('input[type=checkbox][name="' + this.get('name') + '"]').isEmpty()) { // This is the hidden input that is part of an advcheckbox. hidden_val = (this.get('value') != value); return;