Hi there,
I have the following problem and it's driving me nuts. I have several Widgets (on a 2.3.7 installation) like this one:
<?php
class HyperlinkWidget extends Widget {
static $db = array(
'WidgetTitle' => 'Varchar',
'Option1' => 'Boolean',
'Option2' => 'Boolean',
'Option3' => 'Boolean',
'Option4' => 'Boolean',
'Option5' => 'Boolean',
'Option6' => 'Boolean',
'Option7' => 'Boolean',
'HyperlinkTitle1' => 'Varchar',
'HyperlinkTitle2' => 'Varchar',
'Hyperlink1' => 'Varchar',
'Hyperlink2' => 'Varchar'
);
//static $title = "Meer weten?";
static $cmsTitle = "Call to action";
static $description = "Show 'Call to action' links.";
//function Title() {
// return $this->WidgetTitle ? $this->WidgetTitle : self::$title;
//}
function onBeforeWrite() {
if (substr($this->Hyperlink1,0,3) == 'www') {$this->Hyperlink1 = 'http://' . $this->Hyperlink1;}
if (substr($this->Hyperlink2,0,3) == 'www') {$this->Hyperlink2 = 'http://' . $this->Hyperlink2;}
parent::onBeforeWrite();
}
function getCMSFields() {
return new FieldSet(
new TextField('WidgetTitle', 'Title (optional)'),
new CheckboxField('Option1', _t('HyperlinkWidget.OPTION1')),
new CheckboxField('Option6', _t('HyperlinkWidget.OPTION6')),
new CheckboxField('Option7', _t('HyperlinkWidget.OPTION7')),
new CheckboxField('Option2', _t('HyperlinkWidget.OPTION2')),
new CheckboxField('Option3', _t('HyperlinkWidget.OPTION3')),
new CheckboxField('Option4', _t('HyperlinkWidget.OPTION4')),
new CheckboxField('Option5', _t('HyperlinkWidget.OPTION5')),
new TextField('Hyperlink1', 'Additional hyperlink 1 (optional)'),
new TextField('HyperlinkTitle1', 'Hyperlink title (optional)'),
new TextField('Hyperlink2', 'Additional hyperlink 2 (optional)'),
new TextField('HyperlinkTitle2', 'Hyperlink title (optional)')
);
}
}
?>
Now it's perfectly possible to check the checkboxes, but unimpossible to uncheck them after they are checked. Whatever I try, unchecking (followed by 'Save and publish') shows the unchecked checkbox, but upon reload of the CMS the checkbox is checked again :(
Anyone dealt with this before and/or any suggestion where to look for the cause of this problem? Thx thx thx!