View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
10986 | Bug reports | Plugins | public | 2016-04-19 19:22 | 2016-05-24 09:49 |
Reporter | akeyser | Assigned To | DenisChenu | ||
Priority | high | Severity | partial_block | ||
Status | closed | Resolution | fixed | ||
Product Version | 2.50.x | ||||
Fixed in Version | 2.50.x | ||||
Summary | 10986: Survey-specific plugin setting of type "checkbox" does not properly save | ||||
Description | We are creating a plugin that uses a "checkbox" type of field in its survey-specific settings. LimeSurvey is not saving the status of this checkbox upon saving the survey general settings. When a checkbox is used in the plugin's global settings, however, it does save properly. | ||||
Tags | No tags attached. | ||||
Attached Files | checkboxTest.php (1,492 bytes)
<?php /** * User: akeyser */ class CheckboxTest extends PluginBase { protected $storage = 'DbStorage'; static protected $name = "Checkbox Test"; static protected $description = "Test Plugin for Survey-Specific Checkbox Settings"; /** * @param PluginManager $manager * @param int $id */ public function __construct(PluginManager $manager, $id) { parent::__construct($manager, $id); $this->subscribe('beforeSurveySettings'); $this->subscribe('newSurveySettings'); } /** * This event is fired by the administration panel to gather extra settings * available for a survey. * The plugin should return setting meta data. * @internal param PluginEvent $event */ public function beforeSurveySettings() { $event = $this->event; $event->set("surveysettings.{$this->id}", [ 'name' => get_class($this), 'settings' => [ 'checkboxTest' => [ 'type' => 'checkbox', 'label' => 'Checkbox', 'current' => $this->get('checkboxTest', 'Survey', $event->get('survey')) ] ] ]); } /** * Save the settings */ public function newSurveySettings() { $event = $this->event; foreach ($event->get('settings') as $name => $value) { $this->set($name, $value, 'Survey', $event->get('survey')); } } } | ||||
Bug heat | 10 | ||||
Complete LimeSurvey version number (& build) | 160418 | ||||
I will donate to the project if issue is resolved | No | ||||
Browser | Google Chrome 49 | ||||
Database type & version | MySQL 5.6.27-log | ||||
Server OS (if known) | Windows Server 2008 R2 | ||||
Webserver software & version (if known) | IIS 7.5 | ||||
PHP Version | 5.6.14 | ||||
Please attach your plugin. |
|
I will create a plugin that specifically demonstrates this issue. I may be able to get this to you in a few hours. |
|
Okay, I can slightly re-define this issue now. Initially, the checkbox appears as empty. However, once enabled and saved, any further attempt to disable the checkbox and save results in the value still being "true" or "1", so the checkbox stays checked after the settings are saved. Attaching the plugin. |
|
It looks like the same even is fired twice on survey save. |
|
<s>Seems new, last time i tested : work OK (and seems top work on 2.06)</s> OK : checkbox is not in post request : the none is send. |
|
akeyser, while your issue is valid. In general I would recommend using setting type "boolean" instead. It is more abstract (it describes the setting not how it is displayed) and gives a theme developer more control. (For example for booleans one could use: checkbox, radio, dropdown, bootstrap toggle switches and so on). This is unrelated to us fixing the issue though :) |
|
Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=19096 |
|
Fix committed to 2.06lts branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=19097 |
|
Thanks to sammousa (and Yii) |
|
Version 2.50+ Build 160523 released |
|
LimeSurvey: master c9535b08 2016-05-19 15:59 Details Diff |
Fixed issue 10986: Plugin survey setting type "checkbox" does not properly save |
Affected Issues 10986 |
|
mod - application/extensions/SettingsWidget/SettingsWidget.php | Diff File | ||
LimeSurvey: 2.06lts fa6a8013 2016-05-19 16:02 Details Diff |
Fixed issue 10986: Plugin survey setting type "checkbox" does not properly save Dev: cherry-pick have conflict ... |
Affected Issues 10986 |
|
mod - application/extensions/SettingsWidget/SettingsWidget.php | Diff File |
Date Modified | Username | Field | Change |
---|---|---|---|
2016-04-19 19:22 | akeyser | New Issue | |
2016-04-20 11:36 | ollehar | Note Added: 37584 | |
2016-04-20 11:36 | ollehar | Assigned To | => ollehar |
2016-04-20 11:36 | ollehar | Status | new => feedback |
2016-04-20 16:16 | akeyser | Note Added: 37619 | |
2016-04-20 16:16 | akeyser | Status | feedback => assigned |
2016-04-20 23:17 | akeyser | Note Added: 37621 | |
2016-04-20 23:18 | akeyser | File Added: checkboxTest.php | |
2016-05-17 14:32 | c_schmitz | Assigned To | ollehar => DenisChenu |
2016-05-17 14:32 | c_schmitz | Note Added: 38632 | |
2016-05-17 14:32 | c_schmitz | Priority | none => high |
2016-05-17 14:39 | DenisChenu | Note Added: 38633 | |
2016-05-19 11:48 | DenisChenu | Note Edited: 38633 | |
2016-05-19 15:50 | sammousa | Note Added: 38686 | |
2016-05-19 15:59 | DenisChenu | Changeset attached | => LimeSurvey master c9535b08 |
2016-05-19 15:59 | DenisChenu | Note Added: 38687 | |
2016-05-19 15:59 | DenisChenu | Resolution | open => fixed |
2016-05-19 16:03 | DenisChenu | Changeset attached | => LimeSurvey 2.06lts fa6a8013 |
2016-05-19 16:03 | DenisChenu | Note Added: 38688 | |
2016-05-19 17:03 | DenisChenu | Note Added: 38690 | |
2016-05-19 17:03 | DenisChenu | Status | assigned => resolved |
2016-05-19 17:03 | DenisChenu | Fixed in Version | => 2.5 |
2016-05-24 09:49 | c_schmitz | Note Added: 38749 | |
2016-05-24 09:49 | c_schmitz | Status | resolved => closed |