Showing questions randomly (using conditions)

There is no inbuilt way to use conditions to randomly hide or show questions, so what can you do if you want to show different participants different questions?

Here's a method that will allow you to randomly display different questions to different participants.

In summary, you create a hidden question that randomly generates a number. You then hide or display later questions based on the randomly generated number.

If you have 4 questions you'd like to randomly cycle through, then the first question would generate a random number between 1 and 4. If you have 3, then 1 and 3, and so on.

Create a Numerical Type Question Save it, and find the SGQA code (ie: 79346X157X1596). Also find the question code (usually the last part of the SGQA) Edit it, and insert the following javascript in the "Help" section as SOURCE code.

Note that 79346X157X1596 should be replaced with your SGQA code. 1596 should be replaced with your question code.

We hide the question using javascript rather than the advanced setting so that the value can be made available to other questions in the page. Create following questions that have a condition based on whether the constant value for this question is 0 or 1.

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <p> <br>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.