diff --git a/forms/ToggleCompositeField.php b/forms/ToggleCompositeField.php index 44933b161..7f6a92b58 100755 --- a/forms/ToggleCompositeField.php +++ b/forms/ToggleCompositeField.php @@ -14,10 +14,8 @@ class ToggleCompositeField extends CompositeField { function __construct($name, $title, $children) { $this->name = $name; $this->title = $title; - $valueField = new HiddenField($name); - $valueField->addExtraClass('hiddenValue'); - $children->push($valueField); + $this->startClosed(true); parent::__construct($children); } diff --git a/javascript/ToggleCompositeField.js b/javascript/ToggleCompositeField.js index 934a33674..a79edf6ed 100755 --- a/javascript/ToggleCompositeField.js +++ b/javascript/ToggleCompositeField.js @@ -5,7 +5,6 @@ ToggleCompositeField.prototype = { rules['#' + this.id + ' .trigger'] = { onclick: function(e) { this.toggle(); - this.resetHiddenValue(); Event.stop(e); return false; }.bind(this) }; @@ -22,16 +21,6 @@ ToggleCompositeField.prototype = { Element.toggle($$('#' + this.id + ' .contentMore')[0]); Element.toggle($$('#' + this.id + ' .triggerClosed')[0]); Element.toggle($$('#' + this.id + ' .triggerOpened')[0]); - }, - - resetHiddenValue: function() { - var hiddenValue = $$('#' + this.id + ' input.hidden.hiddenValue')[0]; - console.log(hiddenValue.value); - if(hiddenValue.value == 1){ - hiddenValue.value = 0; - }else if(hiddenValue.value == 0){ - hiddenValue.value = 1; - } } } ToggleCompositeField.applyTo('div.toggleCompositeField'); \ No newline at end of file