Have an idea?

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

Free Format Grid Questions On a Mobile Phone

Hello,

I created a free format grid question.  The grid looks good on my laptop but when I review the question on my mobile phone.  The grid is not resizing in order to fit on the mobile phone.

How can I resize the grid so it looks better on a mobile phone?

Thank in advance for  your help
asked Apr 15, 2020 by Sandy
Grid questions come with some handy mobile-friendly functionality baked-in.  Perhaps it would be easier to start from a grid question rather than a free format question in your case.  I assume there was some special requirement that lead to using a free format question in the first place?
Hi,

I created a free-format grid because the first column is a drop down question with an other specify.  I am hiding the 2nd column text box when the first column answer isn't other specify using the code

<script>
$(document).ready(function(){
    $('#[% QuestionName() %]_c1').change(function(){
        $('#[% QuestionName() %]_c2').toggle(SSI_GetValue('[% QuestionName() %]_c1') == 97);
    
    } 
    
    );
    
    
    
    $('#[% QuestionName() %]_c1').change();
    
} )


</script>


I just tried using the above code with the grid question and it didn't work.

1 Answer

0 votes
That code is pretty close.  The only problem is that it hasn't factored in the rows of the grid yet.  For example, the first field would be "GridQ_r1_c1" rather than "GridQ_c1," even if the grid question only had one row.  I've modified your script here:

<script>
$(document).ready(function(){
    var rows = $('input[name="hid_row_list_[% QuestionName() %]"]').val().split(',');
    rows.forEach(function(row){
        var changeFunction = function(){
            $('#[% QuestionName() %]_r' + row + '_c2').toggle(SSI_GetValue('[% QuestionName() %]_r' + row + '_c1') == 97);
        };
        changeFunction();
        $('#[% QuestionName() %]_r' + row + '_c1').change(changeFunction);
    });
})
</script>
answered Apr 17, 2020 by Zachary Platinum Sawtooth Software, Inc. (171,950 points)
...