Have an idea?

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

Disable/Hide checkbox based on a previous multiple punch select question

Is there a way to disable/hide a checkbox based on a previous multiple punch select question?  The row (attributes) is a constructed listed and the column (Teams) is a constructed list.   The maximum number of columns will be 10.  Below is the grid I'm trying to build.  

     Team 1    Team 2    Team 3    Team 4    Team 5    Team 6    Team 7    Team 8    Team 9    Team 10
Attribute 2                                                  
Attribute 3                                                  
Attribute 4                                                  
Attribute 6                                                  
Attribute 7                                  disable check box    disable check box    disable check box     
asked Mar 12 by Bryan
"Disable Graphical Inputs" from the Community Question Library can be used to disable Lighthouse Studio's graphical checkboxes.

https://sawtoothsoftware.com/community-question-library/1739-disable-graphical-inputs

I could write the script for your grid question that would make use of that tool, but I would need to know more about the behavior you want.  What is the exact logic that controls what items are being disabled based on the response to the previous select question?
Here is the row logic in grid
   
    - Constructed list

ADD(AttributeList,2,4)
ADD(AttributeList,6)

Begin Unverified Perl

if(GETVALUE ("B0_7") == 1 || GETVALUE ("B0_8") == 1  || GETVALUE ("B0_9") == 1)
  {
        ADD ("AttributeList",7);
  }


End Unverified

Randomize()


Grid Column logic would be

- Constructed list too

    AIC (B0)

What I looking to do is if

    If the column (B0) equal 1-6 or 10

I would like to hide the each check box in row 7 corresponding with col 1.. col 6 and col 10 if these columns are shown

The only check box for row 7 that should be available is for column 7,8 ,9

1 Answer

0 votes
After you've added the aforementioned "Disable Graphical Inputs," please try adding this script to your grid question:

<script>
$(document).ready(function(){
    SSI_DisableGraphicalInput('[% QuestionName() %]_r7_c1');
    SSI_DisableGraphicalInput('[% QuestionName() %]_r7_c2');
    SSI_DisableGraphicalInput('[% QuestionName() %]_r7_c3');
    SSI_DisableGraphicalInput('[% QuestionName() %]_r7_c4');
    SSI_DisableGraphicalInput('[% QuestionName() %]_r7_c5');
    SSI_DisableGraphicalInput('[% QuestionName() %]_r7_c6');
    SSI_DisableGraphicalInput('[% QuestionName() %]_r7_c10');
})
</script>
answered Mar 12 by Zachary Platinum Sawtooth Software, Inc. (114,850 points)
Thanks Zachary!  This works.  Is there a way to hide as well as disable or just hide the check box for the rows and columns listed below.  The client doesn't like the check box still being visible.

<script>
$(document).ready(function(){
        SSI_DisableGraphicalInput('[% QuestionName() %]_r7_c1');
        SSI_DisableGraphicalInput('[% QuestionName() %]_r7_c2');
        SSI_DisableGraphicalInput('[% QuestionName() %]_r7_c3');
        SSI_DisableGraphicalInput('[% QuestionName() %]_r7_c4');
        SSI_DisableGraphicalInput('[% QuestionName() %]_r7_c5');
        SSI_DisableGraphicalInput('[% QuestionName() %]_r7_c6');
        SSI_DisableGraphicalInput('[% QuestionName() %]_r7_c10');
})
</script>

Sure, try this:

<script>
$(document).ready(function(){
    var arr = [1, 2, 3, 4, 5, 6, 10];
    arr.forEach(function(item){
        SSI_DisableGraphicalInput('[% QuestionName() %]_r7_c' + item);
        $('#[% QuestionName() %]_r7_c' + item + '_graphical').hide();
    });
})
</script>
Thanks Zachary!  I took out line 5 in the script and it worked great.
Whether or not you want to leave in SSI_DisableGraphicalInput is up to you.  Removing it will result in changes to behavior when hovering over / clicking on the area where the checkbox was, as well as visual changes when mobile grid is applied, however.
...