Randomize questions and only show 10 questions via CSS

  • docente.andy
    Asked on October 23, 2020 at 3:56 PM

    I am trying to make a 100 question quiz , with shows 10 random questions in each submission. I used shuffle to sort the questions in a random way, Now I need that only the 10 first questions appear.

    I need to now the CSS syntax and the place where I have to write it.

  • John Support Team Lead
    Replied on October 23, 2020 at 9:56 PM

    Allow me some time to figure out the correct CSS code for this.

    I'll get back to you here shortly.

  • John Support Team Lead
    Replied on October 23, 2020 at 10:31 PM

    Thank you for waiting! So here's what I came up with:

    1.) Added the Shuffle widget in the Form which shuffles the questions each time the form is loaded

    2.) Added the following CSS in the Form. I have added 20 questions (single choice fields) to the Form and each time when the form is loaded I am hiding 10 questions using CSS.

    /*hide all questions*/
    li.form-line[data-type="control_radio"]:nth-of-type(n){display: none;}
    /*show only 10 questions*/
    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;}
    li.form-line[data-type="control_radio"]:nth-of-type(10){display: flex;}
    li.form-line[data-type="control_radio"]:nth-of-type(11){display: flex;}
    li.form-line[data-type="control_radio"]:nth-of-type(12){display: flex;}

    Here's a demo form: https://form.jotform.com/202968576032966

  • docente.andy
    Replied on October 23, 2020 at 11:07 PM

    Thanks JohnRex, I have another question now,

    how can I avoid that shuffle widget works twice o more times before answer submission? It happens when refresh (F5) before the submission.


  • Vanessa_T
    Replied on October 24, 2020 at 3:38 AM

    Will be answering your last concern in a separate ticket linked below:

    https://www.jotform.com/answers/2653268