Have an idea?

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

Show/Hide in Grid questions in the same page

I have 1 grid questions with 7 rows and detail as below:

Q1Row1 is Numeric.
Q1Row2 is Numeric.
Q1Row3 is select Dropdown with "Black/White".
Q1Row4 is Numeric.
Q1Row5 is select Dropdown "Yes/No".
Q1Row6 is Numeric.
Q1Row7 is Numeric.

My conditions are:

If Q1Row3 is "Black" we will pop-up label answer in question of Q1Row4. Ex: please input the price of "Black".  
Or If Q1Row3 is "White" we will pop-up label answer in question of Q1Row4. Ex: please input the price of "White".

If Q1Row5 is "Yes" we will show Q1Row6 and Q1Row7, and ask them. If Q1Row5 is "No" we will hide Q1Row6 and Q1Row7.

Is it possible? If yes, please show me in details.
asked Feb 6 by Saroeun Bronze (1,945 points)

1 Answer

0 votes
Can I assume that it isn't a requirement that this be set up with a grid question?  If this can be split into a handful of select and numeric questions instead, we can use the newly-updated "Branching" tool from the Community Question Library to handle the conditional behavior you want between the last three questions:

https://sawtoothsoftware.com/community-question-library/1731-branching

You'll want your branching settings to look like this, assuming the last three rows are split into questions "Q5," "Q6," and "Q7":

    branchings: [
        {
            dependentQuestion: 'Q6',
            condition: function() {
                return SSI_GetValue('Q5') == 1;
            }
        },
        {
            dependentQuestion: 'Q7',
            condition: function() {
                return SSI_GetValue('Q5') == 1;
            }
        }
    ],


We could add branching behavior for the other questions as well, if you need it.

For the other part, add this to "Q4":

<span class="Q3Resp"></span>


and this to "Q3":

<script>
$(document).ready(updateQ3Resp);
$('#[% QuestionName() %]').change(updateQ3Resp);

function updateQ3Resp() {
    var resp;
    switch (SSI_GetValue('[% QuestionName() %]')) {
        case 1:
            resp = 'Black';
            break;
        case 2:
            resp = 'White';
            break;
    }
    $('.Q3Resp').text(resp);
}
</script>
answered Feb 6 by Zachary Platinum Sawtooth Software, Inc. (144,125 points)
Thanks,

For Row5, Row6 and Row7 is my client's requirement.  Could you help to fix them?
...