Have an idea?

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

Show response option if previous question NOT answered

I would like to have 2 questions on the same page. One with the initial question (i.e. Do you like peanut butter or jelly more? with 1=Peanut Butter 2=Jelly) and a follow-up question (i.e. If you had to decide, do you like peanut butter or jelly better? With a 3rd option added of Don't Know).

Is it possible to have the 3rd answer option show up ONLY if the respondent tries to move forward in the survey (hit the next button) without answering the initial question?
asked 3 days ago by anonymous

1 Answer

0 votes
The question "Branching" from the Community Question Library can handle this:

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

You'll need to download the .zip from that link and add it to your question library in Lighthouse Studio.  Then you can add an instance of "Branching" to your survey on the same page as the other two questions.
answered 3 days ago by Zachary Platinum Sawtooth Software, Inc. (129,150 points)
Thank you Zachary. I can figure out how to show the question conditional to the first answer. The problem I'm running into is how to show the follow-up only when the the first question is blank AND the next button is selected.

Using this:
            question: 'VoteUnd',
            condition: function() {
                return Number(SSI_GetValue('VOTE')) == 0;

has the follow-up showing automatically since there is no answer selected when the page first loads.

Thanks in advance for your reply, and no worries if this is out of scope of Sawtooth help.
What you're asking for could be done with JavaScript, but is it for sure what your questionnaire designer wants?  It seems like a number of users who would have chosen the third option will end up choosing one of the first two options instead because they didn't know not answering was an option - is that what your designer is after?
Yes, it is. Definitely weird but something we wanted to experiment with.
Please put these as the select question's footer and custom JavaScript verification, respectively:

<script>
$(document).ready(function(){
    if (SSI_GetValue('s') == 3) {
        $('#s_3').closest('.clickable').show();
        $('#thirdOptionFlag').val(1);
    }
    else {
        $('#s_3').closest('.clickable').hide();
    }
})
</script>


if (!SSI_GetValue('[% QuestionName() %]') && $('#thirdOptionFlag').val()) {
    strErrorMessage = 'A response is required.';
}


Then add a text question to the same page with this footer and custom JavaScript verification, respectively:

<input id="thirdOptionFlag" value=""/>

<style>
#[% QuestionName() %]_div {
    display: none;
}
</style>


if (!SSI_GetValue('SelectQ') && !$('#thirdOptionFlag').val()) {
    strErrorMessage = 'flag';
    $('#SelectQ_3').closest('.clickable').show();
    $('#thirdOptionFlag').val(1);
}


"SelectQ" must be replaced with the name of the select question.
...