View Issue Details

This bug affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
05181Bug reportsSurvey takingpublic2011-05-25 22:15
Reporterandrewteg Assigned Totpartner  
PrioritynormalSeveritypartial_block 
Status closedResolutionfixed 
Product Version1.91 
Summary05181: List With Comment - Comment Required
Description

I created a survey with a List with Comment question. When I answer it and then come back to it is marked as unanswered (has class missing) even though I answer a radio button item and simply leave the comment blank. I believe that the logic in bCheckQuestionForAnswer requires both the answer and the comment to be filled in. This also effects the Question Index markings.

Steps To Reproduce

Import Survey: Sample Survey for v1.80

Take survey and answer "List with Comment" Question but do not enter comment.

Use Prev/Next to go to another Group.

Browse back to that question and it is marked as unanswered (missing class) despite having an answer but simply no comment.

Additional Information

Bug report recommended by tpartner at http://www.limesurvey.org/en/forum/can-i-do-this-with-limesurvey/61055-confirm-resultsunanswered-questions#61111 which also has this fix for the bCheckQuestionForAnswer function:

  • Check if a question was (at least partially) answered in the current session.
  • @param integer $q - Question id
  • @param array $aFieldnamesInfoInv - Inverted fieldnamesInfo
    */
    function bCheckQuestionForAnswer($q, $aFieldnamesInfoInv)
    {
    //echo "TYPE=".$_SESSION['fieldmap'][$aFieldnamesInfoInv[$q][0]]['type']."|";
    if(@$_SESSION['fieldmap'][$aFieldnamesInfoInv[$q][0]]['type'] != 'M' && @$_SESSION['fieldmap'][$aFieldnamesInfoInv[$q][0]]['type'] != 'O')
    {
    // all answers required
    $bAnsw = true;
    foreach($aFieldnamesInfoInv[$q] as $sField)
    {
    if(!isset($_SESSION[$sField]) || trim($_SESSION[$sField])=='')
    {
    $bAnsw = false;
    break;
    }
    }
    } elseif (@$_SESSION['fieldmap'][$aFieldnamesInfoInv[$q][0]]['type'] == 'O') {
    // list with comment, just list is required
    //echo "<PRE>"; print_r($aFieldnamesInfoInv[$q]); echo "</PRE>";
    $bAnsw = false;
    foreach($aFieldnamesInfoInv[$q] as $sField) {
    if(!strstr($sField, 'comment') && isset($_SESSION[$sField]) && trim($_SESSION[$sField])!='') {
    $bAnsw = true;
    break;
    }
    }
    } else {
    // multiple choice, just one answer is required
    $bAnsw = false;
    foreach($aFieldnamesInfoInv[$q] as $sField)
    {
    if(isset($_SESSION[$sField]) && trim($_SESSION[$sField])!='')
    {
    $bAnsw = true;
    break;
    }
    }
    }
    return $bAnsw;
    }
TagsNo tags attached.
Attached Files
Bug heat6
Complete LimeSurvey version number (& build)10062
I will donate to the project if issue is resolvedNo
BrowserAll
Database type & version145
Server OS (if known)Windows
Webserver software & version (if known)IIS
PHP Version5.2

Users monitoring this issue

andrewteg

Activities

tpartner

tpartner

2011-05-25 21:59

partner   ~15117

Fixed in revision 10124.

I also fixed the same problem with mutliple-options-with-comments questions. Their comments are also no longer required.

Thanks for the report Andrew.

lemeur

lemeur

2011-05-25 22:02

developer   ~15118

Humm,
I'm not sure this is the best fix for this issue as some users may want to enforce filling the comment field.

A better approach would let the survey designer choos if the comment is mandatory or not with a new question attribute.

tpartner, what do you think ?

tpartner

tpartner

2011-05-25 22:07

partner   ~15119

Well, I just followed the existing "Mandatory" requirements. If these question types are set to "Mandatory", a respondent can advance in the survey without completing the comments fields. This makes sense to me.

lemeur

lemeur

2011-05-25 22:12

developer   ~15120

Ah Ok, I thought you changed the default behaviour.
forget my comment then.

tpartner

tpartner

2011-05-25 22:15

partner   ~15121

Nope, the only behaviour change is related to "Show question index / allow jumping".

Issue History

Date Modified Username Field Change
2011-05-19 18:12 andrewteg New Issue
2011-05-19 18:12 andrewteg File Added: list_with_comment_answer_comment_missing.png
2011-05-19 18:12 andrewteg Issue Monitored: andrewteg
2011-05-19 20:25 Mazi Assigned To => tpartner
2011-05-19 20:25 Mazi Status new => assigned
2011-05-25 21:59 tpartner Note Added: 15117
2011-05-25 21:59 tpartner Status assigned => resolved
2011-05-25 21:59 tpartner Resolution open => fixed
2011-05-25 22:02 lemeur Note Added: 15118
2011-05-25 22:02 lemeur Status resolved => feedback
2011-05-25 22:02 lemeur Resolution fixed => reopened
2011-05-25 22:07 tpartner Note Added: 15119
2011-05-25 22:12 lemeur Note Added: 15120
2011-05-25 22:13 lemeur Status feedback => resolved
2011-05-25 22:13 lemeur Resolution reopened => fixed
2011-05-25 22:15 tpartner Note Added: 15121
2011-05-25 22:15 tpartner Status resolved => closed
2021-08-03 23:48 guest Bug heat 4 => 6