Shuffle widget: want to show random 2 out of 10 questions but sometimes only 1 question is shown

  • a_samaan
    Asked on April 29, 2024 at 2:42 AM

    Im trying to create a question bank made of 4 questions where only 1 random question is shown to each student. I went through your guide of CSS code and shuffle feature and everything works fine except sometimes and form displays no question.  I increased the questions to be 2 out of 4.. many cases it works fine and sometimes it only displays 1 question. This happens even in your provided example!

    Jotform Thread 14351971 Screenshot
  • Girish JotForm Support
    Replied on April 29, 2024 at 4:14 AM

    Hi a_samaan,

    Thanks for reaching out to Jotform Support. To achieve your requirements, some modifications need to be done on your form. Allow me to explain:

    1. Move the shuffle widget to the page 1 of your form, and all other quiz questions into page 2.

    2. Go to the widget settings, and enter the field ID numbers of the fields that don't need to be shuffled and update the widget:

    Shuffle widget: want to show random 2 out of 10 questions but sometimes only 1 question is shown Image 1 Screenshot 20

    3. Now remove the CSS codes added to the form, except for the supernova code. That's it.

    Please check this cloned form. All quiz questions on page 2 will get shuffled on every submission or with every page refresh. Give it a try and let us know how it goes.

  • a_samaan
    Replied on April 29, 2024 at 12:26 PM

    Thanks for your reply.

    the suggested clone form does not do what i need.

    What i need for each student to display to him 2 questions randomly out of those 10.

    your suggestion displays all 10 questions to all students in a shuffled manner.

    I hope its clear?

  • Mikhail JotForm Support
    Replied on April 29, 2024 at 2:22 PM

    Hi a_samaan,

    Thanks for getting back to us. I added a CSS code to the sample form of my colleague. Check out the sample screencast below:

    Shuffle widget: want to show random 2 out of 10 questions but sometimes only 1 question is shown Image 1 Screenshot 20

    If this is what you are trying to achieve, you can add the CSS code below. Let me show you how it’s done:

    • Open your form in Form Builder and click on the blue Paint Roller icon on the right side of the screen.
    • Under the Styles tab, paste the code below into the Inject Custom CSS area.
    /*hide all questions*/
    li.form-line[data-type="control_radio"]:nth-of-type(n){display: none;}
    /*show only 2 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;}


    You can check out my cloned form here, which you can also clone to check its configuration.

    Give it a try and let us know if you have any other questions.

  • a_samaan
    Replied on April 30, 2024 at 12:35 AM

    Thank you for replying.

    I checked your clone and the problem is there.

    Each time i refresh the browser (i.e new entry) i get the first part about name etc and when i hit next i get 2 questions as per the CSS code you provided. However at the 5th refresh the form showed only one question instead of 2 as expected.

    And that is the problem i started this ticket for. it should show 2 questions at each refresh which happens most of the time, but sometimes it shows 1 instead of two.. here is a screenshot:

    Shuffle widget: want to show random 2 out of 10 questions but sometimes only 1 question is shown Image 1 Screenshot 20

  • Girish JotForm Support
    Replied on April 30, 2024 at 1:14 AM

    Hi there,

    Yes, the code provided by my teammate should work but as you've mentioned it sometimes shows only 1 question. I've escalated this to our developers to check and we will respond as soon as there is an update.

 
Your Answer