View Issue Details

IDProjectCategoryView StatusLast Update
05181Bug reports[All Projects] Survey takingpublic2011-05-25 22:15
ReporterandrewtegAssigned Totpartner 
Status closedResolutionfixed 
Product Version1.91 
Target VersionFixed in Version 
Summary05181: List With Comment - Comment Required
DescriptionI 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 ReproduceImport 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 InformationBug report recommended by tpartner at 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;
    } elseif (@$_SESSION['fieldmap'][$aFieldnamesInfoInv[$q][0]]['type'] == 'O') {
        // list with comment, just list is required
        //echo "
"; print_r($aFieldnamesInfoInv[$q]); echo "
        $bAnsw = false;
        foreach($aFieldnamesInfoInv[$q] as $sField) {
            if(!strstr($sField, 'comment') && isset($_SESSION[$sField]) && trim($_SESSION[$sField])!='') {
                $bAnsw = true;
    } else {
        // multiple choice, just one answer is required
        $bAnsw = false;
        foreach($aFieldnamesInfoInv[$q] as $sField)
            if(isset($_SESSION[$sField]) && trim($_SESSION[$sField])!='')
                $bAnsw = true;
    return $bAnsw;
TagsNo tags attached.
Complete LimeSurvey version number (& build)10062
I will donate to the project if issue is resolvedNo
Database & DB-Version145
Operating System (Server)Windows
Webserver software & versionIIS
PHP Version5.2



2011-05-19 18:12



2011-05-25 21:59

developer   ~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.


2011-05-25 22:02

developer   ~15118

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 ?


2011-05-25 22:07

developer   ~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.


2011-05-25 22:12

developer   ~15120

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


2011-05-25 22:15

developer   ~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 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