LDAP
Nintex Observer

Quiz with random, unique questions

Hello all


I would like to create a quiz form which shows a random selection out of a list of questions (e.g. 3 questions out of 10 in a list). It should also present 4 connected, possible answers per question (A-D). Finally, the selected answer should be validated against an answer key. 

 

I've achieved the random selection of questions using Javascript. 3 unique random numbers are generated and used to lookup a specific question from the question list.

 

var arr = [];while (arr.length < 3) {    var r = Math.floor(Math.random() * 10) + 1;    if (arr.indexOf(r) === -1) arr.push(r);
    var one = arr[0];    var two = arr[1];    var three = arr[2];} 

NWF$(document).ready(function() {     NWF$("#" + Q1).val(one);});

NWF$(document).ready(function() {     NWF$("#" + Q2).val(two);});

NWF$(document).ready(function() {     NWF$("#" + Q3).val(three);});

 

Now, I would like to show/lookup 4 answers per question (A-D) and validate these against the answer key. (e.g. For question 3, answer B is correct).

 

However, with the last part I'm struggling. Hopefully someone can help me with the correct list structure and lookup for the answers and validation for the answer.

 

Thanks in advance

0 Kudos
Reply
1 Reply
MegaJerk
Automation Master
Automation Master

Re: Quiz with random, unique questions

Looking at the code you've posted, my guess is that you're setting the value of a Control to an integer, so that a Lookup Control (separate) can use that value as a means to filter itself and reveal a question. Is this about right? Or are you somehow setting the value of the Lookup Directly? 

A few images might be more helpful in at least establishing where you're at in the process so that an answer can follow what's already there. 


0 Kudos
Reply