Multiple Choice question moving forward only on correct answer

  • careform
    Asked on February 5, 2021 at 6:29 PM

    Hi am trying to display 3 randomly selected questions from a bigger list of stored question (I used the random widget and conditions to display which questions show), but I only want the user to move to the next question if they answer the previous one correctly (in this demo, I have made 2 answers per question mandatory).

    Here is the test form:

    https://www.jotform.com/210356980378059

    So how can I set the move forward to the next question to be conditional based on the correct responses? I am having two problems:

    • How to set a condition that only accepts the correct responses to a question, otherwise displays an error like, "your selections are wrong - please try again"
    • Because the questions are fairly random, it seems like I'd have to create conditions for every set of displayed questions in order to make this work

    I guess one option could be to display only one question at a time with move to next page only if previous question has the correct answers.

    Could someone please suggest some elegant solutions?

    Thanks

  • Amin JotForm Support
    Replied on February 5, 2021 at 9:58 PM

    Thanks for reaching out to us!

    Kindly note that you can do so as follows:

    1. Place each question in a page.
    2. Create the condition below to show the Next button only if the user chooses the two right answers as shown below. Remember to change the field to show with the Next button.

    1612580111 601e050f880e2  Screenshot 10

    Related guide: How-to-show-or-hide-fields-base-on-users-answer

    Should you have any further inquiries, we will be more than happy to help.

  • careform
    Replied on February 5, 2021 at 11:52 PM

    Thanks

    That's what I thought, but was thinking there could be a way with all questions visible.

  • Mike_G JotForm Support
    Replied on February 6, 2021 at 5:32 AM

    Here is what I understand about your requirements so far:

    1. You would like to only show 3 random fields on your form.
    2. You would like the fields to show one at a time.
    3. You would like the next random field to show when the answer on the previous field is correct.*
    4. The second field is based on the first random field that showed and the third field is based on the second.
    5. You would like the fields on your form to be on the same page and not create multiple pages for each one.

    * Are the second and third fields also random? Or, there are specific (second and third) fields that should show based on the correct answer on the first field?

    Kindly confirm if I understood your concern correctly so we may help you further. If, in any case, I have misunderstood your concern or any of your requirements, please do not hesitate to let us know and please provide us with more information/details.

    We will wait for your response.

  • careform
    Replied on February 6, 2021 at 7:20 PM

    I will answer each question in red next to your words:

    1. You would like to only show 3 random fields on your form. - yes, 3 random questions
    2. You would like the fields to show one at a time. - the questions can either all be visible together, or one at a time, whatever is easier
    3. You would like the next random field to show when the answer on the previous field is correct.* yes
    4. The second field is based on the first random field that showed and the third field is based on the second. each question is not necessarily dependent upon the previous e.g. random question number 8 can come after random question number 12 (if that happens to be the sequence the two questions appear). e.g. we might have 12 questions available, from which 3 will randomly be required to be answered
    5. You would like the fields on your form to be on the same page and not create multiple pages for each one. Ideally, but if it is more complex to achieve this, we don't mind

    * Are the second and third fields also random? Or, there are specific (second and third) fields that should show based on the correct answer on the first field? as per my answer to 4 above, they are random and not necessarily dependent upon a specific question prior

    As can be seen in my further testing, I tried separating each with page breaks, but this creates a further problem because of the random show/hide, so some pages are therefore hidden and I cannot move forward. Keen for your response.


  • VincentJay
    Replied on February 6, 2021 at 8:33 PM

    Please check this demo form: https://form.jotform.com/210367260286050

    In the demo form, if you select the correct answer, it will show a new question. If you select the wrong answer, it will show a warning message and ask you to go back to choose the correct answer. Is that what you're trying to create?

    If yes, you can use the Skip Page condition to achieve that: https://www.jotform.com/help/350-how-to-skip-pages-using-conditional-logic

    Give it a try and let us know if you need further help. If not, please let us know. Thank you!

  • careform
    Replied on February 7, 2021 at 2:22 AM

    @VincentJay

    Maybe I am wrong, but your solution does not work for the scenario that I provided to @mike_g

    There is a list of hidden questions, so the Skip Page requires me to choose the next page to skip to, however, there are mixed scenarios e.g.

    If random number = 1, then show Q1, Q2, Q3

    If random number = 9, then show Q1, Q4, Q7

    So with the above, there are two different pages to skip to after Q1, depending upon the random number generated (a reminder that I am using Random number to decide which 3 questions to display).

    My answers to @Mike_G explain the exact scenario I am trying to build.

    I am still unable to work a solution.


  • Girish JotForm Support
    Replied on February 7, 2021 at 3:38 AM

    Please check this form if it works for you - https://form.jotform.com/210371625286959

    I have set up show/hide conditions as per your requirement when the random value field contains 1 and 9, then show the required questions. I have also removed the page breaks on the form.

    Related guide: https://www.jotform.com/help/196-hide-or-show-multiple-fields-at-once

    Please review and let us know.

  • careform
    Replied on February 7, 2021 at 8:35 AM

    UPDATE - PLEASE MARK AS RESOLVED - I HAD THE WRONG VALUE IN THE CORRECT VARIABLE. ALL GOOD NOW!


    @gerardw

    Your logic doesn't work because:

    • all possible questions show, not just 3 specific questions based on the random number generator

    Finally, there is one part that has been missed from the suggestions above:

    "the next random field to show when the answer on the previous field is correct"

    I have created a new form to test:

    see https://www.jotform.com/210371201166845

    In my example, I am happy for all 3 questions to show and I hide the Submit button until all 3 questions are correctly answered and then try to show the Submit button; but it doesn't work.

    I have logic that requires:

    • 2 answers required from each lot of 4 answers per question
    • Those two answer are choice 3 and choice 4 (to each question)

    If there are less or more than 2 answers to a question, no problem, an error appears based on min/max entry limits = 2

    I have logic that fills a variable with "Correct" for each correct set of answers e.g.

    For random number 1:

    Q1, Q2, Q3 questions correctly appear

    random 2 = Q4,Q5,Q6

    random 3 = Q7,Q8,Q9

    random 4 = Q10.Q11,Q12

    random 5 = Q1,Q3,Q5

    random 6 = Q2,Q4,Q6

    random 7 = Q7,Q9,Q11

    random 8 = Q8,Q10,Q12

    random 9 = Q1,Q4,Q7

    random 0 = Q2,Q6,Q11

    The correct answers to each set of 3 questions are choices 3 and 4 (for simplicity I have set the same sequence for each question - note I set answers to shuffle). I fill 3 variables (Q1 Answer, Q2 Answer, Q3 Answer) with "Correct" if answer 3 & 4 are chosen for each of set of 3 questions above.

    I then check if those three variables are all set to "Correct" and if so, I attempt to show the Submit button.

    1612704927 601fec9f90e02  Screenshot 10

    HOWEVER

    The Submit button does not appear when the correct answers are chosen. I have also tried adding a Section Collapse and trying to show this on the condition that all answers for a given set of questions is correct, but still no good.

    I display the random number and Question Answer fields (with correct answers showing "Correct") to check my logic works. Can anyone see why the Submit button does not match the logic to display it?


    UPDATE - PLEASE MARK AS RESOLVED - I HAD THE WRONG VALUE IN THE CORRECT VARIABLE. ALL GOOD NOW!