Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Widgets /

Discuss SilverStripe Widgets.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Unable to uncheck Widget checkbox


Reply


8 Posts   2242 Views

Avatar
klikhier

Community Member, 150 Posts

29 May 2010 at 3:04am

Edited: 29/05/2010 8:18am

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!

Avatar
klikhier

Community Member, 150 Posts

1 June 2010 at 4:38pm

Anyone?

Avatar
Artyom

Community Member, 22 Posts

20 December 2010 at 8:06pm

I'm having the exact same issue. This is really obnoxious. Basic Field / ORM binding going on here! Moderators, please have a look at this.. it's like a bug!

Avatar
chrclaus

Community Member, 29 Posts

1 February 2011 at 6:29am

Hello,

I have the same problem. The CheckboxField is working on a normal module but don´t do anything on a widget.

Best regards,
chrclaus

Avatar
swaiba

Forum Moderator, 1805 Posts

1 February 2011 at 6:35am

Tons of formfields don't work in the widget sidebar, my suggestion would be to try an Enum(Yes,No). Or a Textfield for Y/N and you do some jQuery to make it behave/look like a checkbox.

Also to get a response I'd check open.silverstripe.com for a known issue - else raise it (worse case they reject it!)

Avatar
chrclaus

Community Member, 29 Posts

1 February 2011 at 10:14pm

Hi,

I found a the ticket #6288 (http://open.silverstripe.org/ticket/6288) which describes the situation. From my point of view this ticket was not committed to any version.
Does anybody else have more informations about this ticket?

Best regards,
chrclaus

Avatar
chrclaus

Community Member, 29 Posts

2 February 2011 at 12:19am

I applies this patch to version 2.4.4 I´m using. At the moment all widgets and the checkboxes are working .

Beside the authors comment in the ticket is there any reason, why this patch is not visible in the daily builds?

Avatar
streetdaddy

32 Posts

18 November 2011 at 4:40am

Same problem still exists in 2.4.6 !!! WTF? Any reason this hasn't been applied to trunk?