Jump to:

794 Posts in 409 Topics by 304 members

Widgets

SilverStripe Forums » Widgets » Unable to uncheck Widget checkbox

Discuss SilverStripe Widgets.

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

Page: 1
Go to End
Author Topic: 2160 Views
  • klikhier
    Avatar
    Community Member
    150 Posts

    Unable to uncheck Widget checkbox Link to this post

    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!

  • klikhier
    Avatar
    Community Member
    150 Posts

    Re: Unable to uncheck Widget checkbox Link to this post

    Anyone?

  • Artyom
    Avatar
    Community Member
    22 Posts

    Re: Unable to uncheck Widget checkbox Link to this post

    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!

  • chrclaus
    Avatar
    Community Member
    29 Posts

    Re: Unable to uncheck Widget checkbox Link to this post

    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

  • swaiba
    Avatar
    Forum Moderator
    1792 Posts

    Re: Unable to uncheck Widget checkbox Link to this post

    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!)

  • chrclaus
    Avatar
    Community Member
    29 Posts

    Re: Unable to uncheck Widget checkbox Link to this post

    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

  • chrclaus
    Avatar
    Community Member
    29 Posts

    Re: Unable to uncheck Widget checkbox Link to this post

    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?

  • streetdaddy
    Avatar
    32 Posts

    Re: Unable to uncheck Widget checkbox Link to this post

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

    2160 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.