From 72a6a4cbc35ba069b8483e33aab1f6dee0c97db4 Mon Sep 17 00:00:00 2001 From: Normann Lou Date: Fri, 19 Jun 2009 02:38:33 +0000 Subject: [PATCH] FEATURE: roll back r79604 which is to make a ToggleCompositeField able to save back a boolean value if its name is a boolean field of the related object. the reason is this feature is not necessary cos SelectionGroup address the same thing. git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@79616 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- forms/ToggleCompositeField.php | 4 +--- javascript/ToggleCompositeField.js | 11 ----------- 2 files changed, 1 insertion(+), 14 deletions(-) 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