lundi 19 juin 2017

Make a HTML form in random order when refreshing

How do I make a HTML form in a random order? This is my HTML code:

<div class="form-row">
            <label>
                <span>Welke game heeft géén multiplayer?</span>
                <select name="geen_multiplayer">
                    <option selected disabled>Maak een keuze</option>
                    <option>Red Dead Redemption 2</option>
                    <option>Destiny 2</option>
                    <option>South Park: The Fractured but Whole</option>
                    <option>FIFA 18</option>
                </select>
            </label>
        </div>


        <div class="form-row">
            <label>
                <span>Welke game is door Rockstar Games gemaakt?</span>
                <select name="gemaakt_rockstar">
                    <option selected disabled>Maak een keuze</option>
                    <option>Star Wars Battlefront II</option>
                    <option>The Elder Scrolls Online: Morrowind</option>
                    <option>Destiny 2</option>
                    <option>Red Dead Redemption 2</option>
                </select>
            </label>
        </div>

        <div class="form-row">
            <label>
                <span>Wat is géén shooter?</span>
                <select name="geen_shooter">
                    <option selected disabled>Maak een keuze</option>
                    <option>Red Dead Redemption 2</option>
                    <option>Destiny 2</option>
                    <option>Call of Duty: WWII</option>
                    <option>Star Wars Battlefront II</option>
                </select>
            </label>

So these are 3 questions. I would like to make it so that when you refresh the page, the questions will be in a random order. I am also using python, but I don't if I need that to make it random. I am accesing the form like this in python:

if (request.form["gemaakt_rockstar"] == "Red Dead Redemption 2"):
    score += 1

Is there a way to make these questions in a random order? Do I need python or something else?

EDIT: I already tried this code, but it doesn't work: http://ift.tt/2rwUsQ1




Aucun commentaire:

Enregistrer un commentaire