LimeSurvey issue tracker
Registration

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
05181Bug reports[All Projects] Survey takingpublic2011-05-19 18:122011-05-25 22:15
Reporterandrewteg 
Assigned Totpartner 
PrioritynormalSeveritymajor 
StatusclosedResolutionfixed 
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 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 "
"; print_r($aFieldnamesInfoInv[$q]); echo "
";
        $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;
}
I will donate to the project if issue is resolved within 48 hrsNo
LimeSurvey build number OR git commit ID10062
BrowserAll
Database & DB-Version145
Operating System (Server)Windows
Webserver software & versionIIS
PHP Version5.2
Attached Filespng file icon list_with_comment_answer_comment_missing.png [^] (9,172 bytes) 2011-05-19 18:12

- Relationships

-  Notes
User avatar (15117)
tpartner (developer)
2011-05-25 21:59

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.
User avatar (15118)
lemeur (administrator)
2011-05-25 22:02

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 ?
User avatar (15119)
tpartner (developer)
2011-05-25 22:07

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.
User avatar (15120)
lemeur (administrator)
2011-05-25 22:12

Ah Ok, I thought you changed the default behaviour.
forget my comment then.
User avatar (15121)
tpartner (developer)
2011-05-25 22:15

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


Copyright © 2000 - 2014 MantisBT Team
Powered by Mantis Bugtracker