Professional Web Applications Themes

Timed quiz - Coldfusion - Advanced Techniques

I've created an online quiz . Two things can happen- 1) the person finishes anwering all the questions and sends the results to an action page via send button which grades the test and displays % correct. 2) the test times out- but the results at timeout still need to go to the action page to get graded (it would say "you answered x questions out of x". A simple html redirect?...

  1. #1

    Default Timed quiz

    I've created an online quiz . Two things can happen-

    1) the person finishes anwering all the questions and sends the results to an
    action page via send button which grades the test and displays % correct.
    2) the test times out- but the results at timeout still need to go to the
    action page to get graded (it would say "you answered x questions out of x".

    A simple html redirect?

    rinorman Guest

  2. #2

    Default Re: Timed quiz

    i suppose it depends on how your timing out your test. are you timing out & submitting or doing a refresh?
    PaulH Guest

  3. #3

    Default Re: Timed quiz

    The action page scores and times the quiz- so the auto time-out would need to
    send the current info to the action page as if the quiz-taker had submitted
    manually.

    Also, while I'm at it- if any of these questions could be answered, it would
    be a big help-

    Some quiz questions are yes/no true/false, most are multiple choice but some
    have 4 choices and others have 6.

    Because each question has at least 2 choices, I tried to display the questions
    dynamically with:

    <ol start="a" type="a">
    <li><input type="Radio" name="ans" value="ans_a"> #ans_a#<br>
    <li><input type="Radio" name="ans" value="ans_b"> #ans_b#<br>
    <cfif #ans_c# IS NOT ""><li><input type="Radio" name="ans"
    value="ans_c"> #ans_c#</li></cfif>
    <cfif #ans_d# IS NOT ""><li><input type="Radio" name="ans"
    value="ans_d"> #ans_d#</li></cfif>
    <cfif #ans_e# IS NOT ""><li><input type="Radio" name="ans"
    value="ans_e"> #ans_e#</li></cfif>
    <cfif #ans_f# IS NOT ""><li><input type="Radio" name="ans"
    value="ans_f"> #ans_f#</li></cfif>
    <cfif #ans_g# IS NOT ""><li><input type="Radio" name="ans"
    value="ans_g"> #ans_g#</li></cfif></ol>

    But the radio buttons don't stay ticked. So now I am starting a new query for
    each question on the quiz page, and on the action page, using this code block
    for each qustion:

    <CFSET num_correct =0>

    <cfoutput>
    <cfif #ans_02# eq #ans_02_correct#>
    <CFSET num_correct = num_correct +1>
    <cfelse><CFSET num_correct = num_correct +0>
    </cfif></cfoutput>

    I bet there's an easier way!

    Also, how would I be able to display the quiz questions in random order?
    Right now, each qustion is set up this way:

    <cfquery name="disp10" datasource="some data.mdb" dbtype="ODBC">
    SELECT quest_ID, quest_text, ans_a, ans_b, ans_correct
    FROM test001_guest_main
    WHERE quest_ID = 10
    </cfquery>

    <cfoutput query="disp10">
    <tr>
    <td width="800" align="left" valign="top">

    <p>#quest_ID#) #quest_text#</p>
    <ol start="a" type="a">
    <li><input type="radio" name="ans_10" value="ans_a"> #ans_a#<br>
    <li><input type="radio" name="ans_10" value="ans_b"> #ans_b#<br>

    </ol>
    </ol>
    </td>
    </tr>
    <input type="hidden" name="quest_ID" value="#quest_ID#">
    <input type="hidden" name="ans_10_correct" value="#ans_correct#">
    </cfoutput>

    THANKS!

    rinorman Guest

  4. #4

    Default Re: Timed quiz

    are you asking how to timeout and submit the form? if so i guess you can use some and the [url]http://www.devguru.com/Technologies/ecmascript/quickref/win_settimeout.html[/url] function.


    PaulH Guest

  5. #5

    Default Re: Timed quiz

    The problem: If the testee does not finish the quiz in time, several questions
    will not be answred. The way the action page is set up- if all questions do not
    have a coice selected, there will be an error message.

    On the test page, each qustion has its own query. For instance, question 2::

    <cfquery name="disp02" datasource="quiz_data.mdb" dbtype="ODBC">
    SELECT quest_ID, quest_text, ans_a, ans_b, ans_c, ans_d, ans_correct
    FROM test001_guest_main
    WHERE quest_ID = 2
    </cfquery>

    <cfoutput query="disp02">
    <tr>
    <td width="800" align="left" valign="top">
    <font face="Verdana, Helvetica, sans-serif" size="2">
    <p>#quest_ID#) #quest_text#</p>
    <ol start="a" type="a">
    <li><input type="radio" name="ans_02" value="ans_a"> #ans_a#</li>
    <li><input type="radio" name="ans_02" value="ans_b"> #ans_b#</li>
    <li><input type="radio" name="ans_02" value="ans_c"> #ans_c#</li>
    <li><input type="radio" name="ans_02" value="ans_d"> #ans_d#</li>
    </ol>


    </td>
    </tr>
    <input type="hidden" name="quest_ID" value="#quest_ID#">
    <input type="hidden" name="ans_02_correct" value="#ans_correct#">
    </cfoutput>

    Then, each answer is checked on the action page:

    <cfoutput>
    <cfif #ans_02# eq #ans_02_correct#>
    <CFSET num_correct = num_correct +1>
    <cfelse><CFSET num_correct = num_correct +0>
    </cfif></cfoutput>

    Because of this design, unanswered questions will cause an error-I'm sure
    there's an easier way to
    1) display each question
    2) tally correctly answered questions
    3) prevent error messages for unanswered qustions
    4) display questions in random order yet have them numbered in sequence on the
    test-

    THANKS AGAIN

    rinorman Guest

  6. #6

    Default Re: Timed quiz

    the quick and dirty way is to use cfparam on your action page:

    <cfparam name="form.someFormName" default="defaultNoAnswerValue">
    PaulH Guest

Similar Threads

  1. Timed Out Requests
    By athanasiusrc in forum Coldfusion Server Administration
    Replies: 1
    Last Post: November 10th, 01:46 AM
  2. Timed Submit
    By Dtrader in forum Coldfusion - Getting Started
    Replies: 4
    Last Post: August 11th, 05:04 PM
  3. Operation Timed Out
    By Robert May in forum ASP.NET Web Services
    Replies: 0
    Last Post: July 6th, 03:02 PM
  4. The Operation has timed-out
    By Romano Live in forum ASP.NET
    Replies: 0
    Last Post: October 27th, 01:14 PM
  5. Quiz Quiz Quiz but how to customise??
    By Adam Vernon in forum Macromedia Director Lingo
    Replies: 2
    Last Post: July 24th, 07:42 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139