Have an idea?

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

How to hide a question unless a specific response for another question has been chosen?

Hello guys!

I have a single-select question Q1 with two options and another numeric-question Q2 where you need to put in an integer. They are on the same page and I only want to show Q2, if the second option for Q1 has been selected. If the first option or no option has been selected, Q2 should not show.

I have tried a few solutions from other threads, but with little success. Furthermore every time I implement any kind of Javascript, the error message "SSI_UpdateQuestionErrHash(strVarName, strQuestName, strErrorMessage); }" is shown at the top of the page.

I would really appreciate any kind of help :)
asked Feb 22 by Howtohidethequestion
Perhaps I can offer some clarification regarding "SSI_UpdateQuestionErrHash."  When it comes to adding JavaScript to a question, there are two ways it can go.

The first way is with the custom JavaScript verification field, found within a question's advanced settings.  As the name suggests, this is only for defining special verification for a question, such a requiring two questions have different answers.  When adding script here, you should not include "<script>" tags as this field already knows it is expecting JavaScript.

The second way is with any of the other HTML-permitting fields of the question.  I typically use either the footer field, the HTML field (in free formats), or the HTML head field (when it is available in the advanced settings).  This is for script that is to run before the respondent clicks the submit button, such as when the page loads up or when the respondent clicks on or types into an element on the page.  When adding script to one of these fields, you must include "<script>" tags to specify that you are inputting JavaScript.

1 Answer

0 votes
You need to use the branching question from the question library:

https://sawtoothsoftware.com/support/question-library
answered Feb 22 by Jay Rutherford Gold (32,940 points)
...