View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
05121Bug reportsSurvey editingpublic2011-08-30 17:44
ReporterMazi Assigned Todionet  
PriorityhighSeveritypartial_block 
Status closedResolutionfixed 
Product Version1.91RC6 
Target Version1.91Fixed in Version1.91+ 
Summary05121: Can't set default answers / answer set not saved?
Description

When trying to set a default answer for a list radio (flexible labels) I can select a value and click save but when returning to the same screen there is still the "no default" choice shown.
Either the previously set answer isn't loaded as set default answer or - my guess - the value isn't saved at all?!

Steps To Reproduce
  1. Create a new survey with a list radio (flexible labels) question.
  2. Go to the default answer screen
  3. Select a default answer from the dropdown list
  4. Click save.
  5. Go back to the default answer screen
    -> no answer is shown as being selected as default answer.
TagsNo tags attached.
Attached Files
database.diff (737 bytes)   
Index: database.php
===================================================================
--- database.php	(revision 10017)
+++ database.php	(working copy)
@@ -1509,7 +1509,7 @@
    else
    {
        $exists=$connect->GetOne("SELECT qid FROM ".db_table_name('defaultvalues')." WHERE sqid=$sqid AND qid=$qid AND specialtype=$specialtype'' AND scale_id={$scale_id} AND language='{$language}'");
-       if ($exists===false)
+       if ($exists===false || $exists===null)
        {
            $connect->execute('INSERT INTO '.db_table_name('defaultvalues')." (defaultvalue,qid,scale_id,language,specialtype,sqid) VALUES (".db_quoteall($defaultvalue,$ispost).",{$qid},{$scale_id},'{$language}','{$specialtype}',{$sqid})");        
        }
database.diff (737 bytes)   
Bug heat4
Complete LimeSurvey version number (& build)9999
I will donate to the project if issue is resolvedNo
BrowserFirefox 3.6
Database type & versionMySQL 5
Server OS (if known)Win 7
Webserver software & version (if known)Apache 2.2
PHP Version5.3.1

Users monitoring this issue

There are no users monitoring this issue.

Activities

dionet

dionet

2011-04-21 23:56

reporter   ~14852

This was happening because the condition that tested if a default value was set didn't work for null, so it was trying to update a value that didn't exist.

Please check the patch.

Thank you,
dionet

c_schmitz

c_schmitz

2011-05-03 19:58

administrator   ~14911

Looks great, please commit to /limesurvey

Issue History

Date Modified Username Field Change
2011-04-20 01:14 Mazi New Issue
2011-04-20 01:14 Mazi Status new => assigned
2011-04-20 01:14 Mazi Assigned To => c_schmitz
2011-04-20 01:23 dionet Assigned To c_schmitz => dionet
2011-04-21 23:46 dionet File Added: database.diff
2011-04-21 23:56 dionet Note Added: 14852
2011-04-21 23:56 dionet Assigned To dionet => c_schmitz
2011-05-03 19:58 c_schmitz Assigned To c_schmitz => dionet
2011-05-03 19:58 c_schmitz Note Added: 14911
2011-05-05 22:16 dionet Status assigned => resolved
2011-05-05 22:16 dionet Fixed in Version => 1.91+
2011-05-05 22:16 dionet Resolution open => fixed
2011-05-15 12:27 c_schmitz Status resolved => closed
2011-08-30 17:43 Chiefer Issue Monitored: Chiefer
2011-08-30 17:44 Chiefer Issue End Monitor: Chiefer
2019-11-01 17:25 c_schmitz Category Survey design => Survey editing