Have an idea?

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

restrictions options in grid question

I have a row-based grid question with 10 rows (statements) and 2 columns (yes/no).  I would like to put the following restriction in the rows:
* if row 1 = yes,  row 2 cannot be yes
* if row 6 = yes, row 7 cannot be yes
* if row 8 = yes, row 9 cannot be yes

It is important that the respondent considers all statments at the same time, that's why we us the grid-question.

Can someone help me with the script to make this possible?
asked Feb 18 by jeroen
How are you imagining these restrictions?  An error when a respondent tries to submit an invalid response?  Disabling prohibited radio buttons automatically when responses are changed?  Something else?
Disbaling buttons automatically when responsens change would be great!

1 Answer

0 votes
We'll need to start by adding a copy of the "Better Lighthouse Library" to this page.  You can download this question and add it to your question library from here:


With that on the page, you can add this script to your grid question to apply the behavior you are after:

    // Params
    var rules = [
        [1, 2],
        [6, 7],
        [8, 9]
    // Run
    $(document).on('lighthouseRadioButtonChanged', function(){
            var independent = rule[0];
            var dependent = rule[1];
            if (SSI_GetValue('[% QuestionName() %]_r' + independent) == 1) {
                if (SSI_GetValue('[% QuestionName() %]_r' + dependent) == 1) {
                    SSI_RadioReset('[% QuestionName() %]_r' + dependent);
                SSI_DisableRadioButtonOrCheckbox('[% QuestionName() %]_r' + dependent + '_1');
            else {
                SSI_EnableRadioButtonOrCheckbox('[% QuestionName() %]_r' + dependent + '_1');
answered Feb 18 by Zachary Platinum Sawtooth Software, Inc. (171,950 points)
Thank you, this works great!
One more question: i would like to 'hide' row 9 only for respondents that selected answer B in Q1, since this row is not relevant for them. How can i do this?
Is Q1 on the same page as this grid or on a previous page?
On a previous page
The usual way to do something like that in Lighthouse Studio is to create a constructed list that only adds the 9th item for certain responses to Q1.  Then you can set your grid question to use that constructed list and that row will automatically be shown or hidden for you.