Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Grid logic Single and Multiple question

Dear All,

I have a grid question with 5 rows and 3 columns. Question direction is "Column".

Column 1: Single select.
Column 2: Multiple select.
Column 3: Multiple select.

I want to everyone can select only one answer for a row.
asked Aug 24 by Saroeun

2 Answers

+1 vote
Try this custom JavaScript verification:

var col1Resp = SSI_GetValue('[% QuestionName() %]_c1');
for (var row = 1; row <= 5; row++) {
    var count = Number(col1Resp == row);
    count += SSI_GetValue('[% QuestionName() %]_r' + row + '_c2');
    count += SSI_GetValue('[% QuestionName() %]_r' + row + '_c3');
    if (count > 1) {
        strErrorMessage = 'Error';
    }
}
answered Aug 24 by Zachary Platinum Sawtooth Software, Inc. (63,900 points)
Zachary, thanks you are the best.

But, the Row 5 is "Don't know" we allow them can select for all columns.

Could you help one more?
You can just replace the "5" in the code with a "4."
Thanks so much.
0 votes
you can also achieve this by following the below steps:

1) design the question with 5 rows and 3 columns, Question direction is "Row wise", select "Exclusive (None of the above)" option for all the 3 columns

2) change the check boxes to radio buttons ( below is the code for your reference)

Footer code:

$("#[% QuestionName() %]_r1_c1_graphical").before('<div id="rdummy" class="graphical_select radiobox"></div>');
$("#[% QuestionName() %]_r1_c1_graphical").hide();

function SSI_CustomGraphicalCheckbox(GraphicalCheckboxObj, InputObj, blnCheck)
{
        //var id=InputObj.id;
        if(blnCheck==true && InputObj.id=="[% QuestionName() %]_r1_c1")
        {
            {
                $("#rdummy").removeClass("radiobox");
                $("#rdummy").addClass("radioboxselected");
                $("#[% QuestionName() %]_r1_c1_graphical").parent().bind('click',function(){SSI_SetSelect("[% QuestionName() %]_r1_c1",true);});
            }
        }
        if(blnCheck==false && InputObj.id=="[% QuestionName() %]_r1_c1")
        {
            $("#rdummy").removeClass("radioboxselected");
            $("#rdummy").addClass("radiobox");
        }
}

above code is for only 1 row, you need to duplicate the same for remaining rows.
answered Aug 24 by anonymous
...