How to show questions randomly and display a Tank You page based on result?

  • et_jotform
    Domanda del 5 novembre 2024 alle ore 07:01

    I have a series of questions and answers (50), in the form I want to show only a maximum of 5, chosen "randomly" every time I open the form.

    The result of the answers given to these questions (random) must be displayed at the end on the thank you page. 

    The objective is to "REWARD" with a gadget (this form will be used in a fair) who correctly answers all questions and showing the result.

  • Vincenzo Jotform Support
    Risposta del 5 novembre 2024 alle ore 07:27

    Hi et_jotform,

    Show questions randomly and displaying a custom Tank You page based on the question score is easy. Let me show you how:

    1. Add your 50 questions to the form.
    2. Next, click on your question and then on the Gear icon that will appear on its right side.
    3. In the panel that will appear on the right side of the screen, click on the Option tab.
    4. Enable the Calculation Value option and give the value 1 to the correct answer. Repeat these steps for each question. How to show questions randomly and display a Tank You page based on result?  Image 1 Screenshot 80
    5. Now, click on the + Add Form Elements button in the top left side of the screen.
    6. Click on the Widget tab and add the Form Calculation widget to the form.
    7. Next, in the panel on the right of the screen, click on the Add Field button.
    8. Add all the question fields and a + symbol in between, then click on Save.
      How to show questions randomly and display a Tank You page based on result?  Image 2 Screenshot 91
    9. Now, click on the Gear icon of the Calculation Form widget, then click on the Advanced tab and set the Hide filed option to ON. How to show questions randomly and display a Tank You page based on result?  Image 3 Screenshot 102
    10. In the orange navigation bar at the top of the page, click on Settings.
    11. In the column on the left, click on Conditions then select the Change Thank You Page option.
      How to show questions randomly and display a Tank You page based on result?  Image 4 Screenshot 113
    12. Set the condition as displayed in the screenshot below, then click on Save:
      How to show questions randomly and display a Tank You page based on result?  Image 5 Screenshot 124
    13. Finally, create a condition for each score.

    We also have a guide about How to Change the Thank You Page URL Conditionally and a guide about How to Perform Calculations Using a Widget that you can check out. Now, since you want to show only 5 of your 50 questions. You will need to inject a CSS code. Doing that is easy, let me show you how:

    1. In Form Builder, click on the Form Designer button, on the top right side of the screen.
    2. Next, click on the Style tab.
    3. Scroll down to Inject Custom CSS and paste the code provided below:
    /*Code to hide all questions - 20816961 */
    li.form-line[data-type="control_radio"]:nth-of-type(n){display: none;}
    /*Code to show only 5 questions*/
    li.form-line[data-type="control_radio"]:nth-of-type(2){display: flex;}
    li.form-line[data-type="control_radio"]:nth-of-type(3){display: flex;}
    li.form-line[data-type="control_radio"]:nth-of-type(4){display: flex;}
    li.form-line[data-type="control_radio"]:nth-of-type(5){display: flex;}
    li.form-line[data-type="control_radio"]:nth-of-type(6){display: flex;}
    li.form-line[data-type="control_radio"]:nth-of-type(7){display: flex;}
    li.form-line[data-type="control_radio"]:nth-of-type(8){display: flex;}
    li.form-line[data-type="control_radio"]:nth-of-type(9){display: flex;}
    /*Code Ends Here */

    How to show questions randomly and display a Tank You page based on result?  Image 6 Screenshot 135

    Result:

    How to show questions randomly and display a Tank You page based on result?  Image 7 Screenshot 146

    Here you can test this demo form or clone it to better understand how it was configured. 

    Give it a try and reach out again if you have any other questions.

  • et_jotform
    Risposta del 6 novembre 2024 alle ore 02:41

    Perfect Vincenzo, this solution is much better and works.

    Forgive me if I insist (if you can not .. does nothing), but could I appear in the page of thanks besides the number of correct answers, indicate also which are?

    If I’m overdoing it tell me! : )

    Thank you so much for all the support!

  • Joseph Jotform Support
    Risposta del 6 novembre 2024 alle ore 03:23

    Hi et_jotform,

    I tested a bit and I found a solution for this. It's a bit long and requires different settings, but your goal could be reached. Here's how to do it:

    1. In Form Builder, add a Short Text field for each question and hide them. I've called them D2, D3, etc...How to show questions randomly and display a Tank You page based on result?  Image 1 Screenshot 50
    2. Now, set an Update/Calculate Field condition for each question. You need to set it as below. The conditions should insert the question and/or the answer in the Short Text field only if it's correct.How to show questions randomly and display a Tank You page based on result?  Image 2 Screenshot 61
    3. Now, go to the Thank You pages, and insert all the IDs of your Short Text fields.How to show questions randomly and display a Tank You page based on result?  Image 3 Screenshot 72

    Now, only the correct answer will be transferred to the Short Text fields (D2, D3, etc..) and only these fields that contain values will shown on the Thank You page. Note that since you have multiple, you need to add all the fields into all the Thank You pages. Here's the result:

    How to show questions randomly and display a Tank You page based on result?  Image 4 Screenshot 83

    As you can see, on the Thank You page, I've added D2 and D3, but only the result for D2 is shown on the Thank You page because is the only field that has been filled with a correct answer.

    Give it a try and let us know if you need any other help.