1. Case study: Quiz - solution

    Article: AN0002356Updated: 25.01.2021

    Data model of this solution will be very simple. We can go with one class for storing the responses with columns First and last name, Email, Question 1, Question 2 etc. In this simple example we will define the questions and correct answers directly in scripts.

    Further we will create a Page for quiz and Page for drawing

    Page for quiz

    On tab Page scheme we will select Custom and define our custom scheme:

    {{0:Content}}
    <div class="c">
    {{Button:save}}
    </div>
    <br/><br/><br/>

    We will insert two webparts into the page. Webpart HTML text for defining page headline and webpart Script for defining questions, drawing the form controls and defining styles.

     

    The resulting page for Quiz looks like this:

     

    Page for drawing

    On tab Page scheme we will select Custom and define our custom scheme:

    {{0:Content}}
    <div class="c">
    {{Button:save}}
    </div>
    <br/><br/><br/>

    We define in the page script that the button for drawing should be displayed only if repeated drawing is allowed or the winner was not yet drawn. That is something we will find from model parameters.

    We will insert two webparts of type Script into the page. The first webpart defines styles and assesses correct answers. The second webpart draws randomly selected winner after clicking on button Draw.

     

    The resulting page for Drawing looks like this:

     

    Both pages and their webparts have to be equipped with scripts that will provide us with the functionality we need.

×