Permalink
Browse files

MDL-30658 formslib: fix JavaScript regression from MDL-27045.

  • Loading branch information...
1 parent 9283723 commit 221b8fd72b521f858bbc71b95298b53278ba173c @timhunt timhunt committed Dec 8, 2011
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/form/form.js
View
@@ -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;

0 comments on commit 221b8fd

Please sign in to comment.