mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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
This commit is contained in:
parent
54a79cf9f3
commit
72a6a4cbc3
@ -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);
|
||||
}
|
||||
|
@ -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');
|
Loading…
Reference in New Issue
Block a user