The mgiQuiz Tag

Tag Behavior

The mgiQuiz tag allows website visitors to take a quiz designed by the site administrator. The mgiQuiz tag also scores the quiz and records the quiz scores.


Tag Syntax

The mgiQuiz tag has three required parameters and four optional parameters. The tag form is:

<mgiQuiz databaseFileLocation="File Path"
tableName="Name" formatFileLocation="File Path"
maximumQuizGrade="Number" checkboxGradingMethod="Method"
timer="On/Off" mode="Mode">

Required Parameters:

  • databaseFileLocation="File Path" where "File Path" is the name of the database file where the quiz key and answers are stored. The database file must be at or below the level of the page containing mgiQuiz. If the file does not exist, mgiQuiz will create it. Multiple quizzes (quiz tables) can be stored in one database file.
  • tableName="Name" where "Name" is the name of the quiz table where the quiz key and answers are stored. (Not required in admin mode).
  • formatFileLocation="File Path" where "File Path" is the HTML form that displays text fields for the quiz-taker's identification information (First Name, Last Name, and ID) and radio buttons, checkboxes, or pull-down menus for the quiz questions and answers. You are not required to collect the quiz-taker's identity, but if you choose to collect their identification information, you must include three text fields named "First Name", "Last Name" and "ID". For each quiz question, format the answers as radio buttons, checkboxes or pull-down menus and name each set of radio buttons, each set of checkboxes, and each pull-down menu uniquely. Radio buttons and pull-down menus allow the user to choose one answer. Checkboxes allow the user to choose multiple answers (see the optional checkboxgradingmethod parameter for questions with multiple answers). The format file does not contain the quiz answers (The first quiz taken sets the quiz key). The format file must contain a Submit button and HTML form tags whose action references the Processing page.

Optional Parameters:

  • maximumQuizGrade="Number" where "Number" is the numeric value of the maximum possible score for the quiz. The default maximum quiz grade is 100.
  • checkboxGradingMethod="Method" where "Method" is the grading scheme for questions with multiple answers. The default checkbox grading method is "Fractional". The possible methods include:
    • "Individual" With the Individual checkbox grading method, each checkbox answer for a question is worth one point. Partial credit can thus be awarded for questions with multiple required answers (e.g. "Choose the three elements in this compound"). Each checkbox answer is worth as many points as an entire question using radio buttons or pull-down menus. A point is awarded for checking correct answers and not checking incorrect answers. A point is deducted for checking incorrect answers or not checking correct answers.
    • "Fractional" With the Fractional checkbox grading method, each set of checkbox answers is worth one point. Therefore, each checkbox is worth a fraction of one point (the fraction depends on the number of checkboxes in the set). A fractional point is awarded for checking correct answers and not checking incorrect answers. A fractional point is deducted for checking incorrect answers or not checking correct answers.
    • "Whole" With the Whole checkbox grading method, each set of checkboxes is graded as "correct" or "incorrect" and each set is worth one point. A point is awarded for checking all correct answers and not checking incorrect answers. A point is deducted if any correct answer is not checked or any incorrect answer is checked.
  • timer="On/Off" where "On" sets a timer which records the elapsed time between the second the quiz is loaded in the browser to the second the quiz answers are submitted and where "Off" does not record the elapsed time of the quiz. In order to time quizzes, the timer parameter must be entered in all mgiQuiz tags (including the mgiQuiz tag with the admin mode) and mgiToken tags must be entered at the top and bottom of every page including the Entry Page, the Quiz Page, and the Processing Page. The default value is "Off".
  • mode="Mode" where "Mode" is the current mode of the mgiQuiz tag. The "Admin" mode displays the mgiQuiz administrative interface. Using the admin mode, you can view quiz grades and search quizzes (by name or a range of scores) and export quiz grades to a table or tab-delimited file. The "KeyDisplay" mode displays the quiz key (the first record in the quiz database). (Note: the tableName parameter is not required in admin mode).

Quiz Variables:

  • mgiQuizGrade - the mgiQuizGrade variable contains the current quiz-taker's grade.


Example Usage and Output

The Entry Page:

If you are timing quizzes, you must enter the quiz page via a page containing mgiToken tags so that tokens are appended to and carried through the URL. If you are not timing quizzes, the entry page is not required. A simple entry page would contain:

<mgiToken>
<a href="quiz.html">Click Here to Take Quiz 1</a>
</mgiToken>

The Quiz Page:

The quiz page contains the mgiQuiz tag and mgiToken tags (if you are timing quizzes). The quiz page displays the quiz questions, answers, HTML form tags and submit button as defined in the format file. An example quiz page would contain:

<mgiToken>

<mgiQuiz databaseFileLocation="Chemistry"
tableName="Quiz1" formatFileLocation="quiz1format.txt"
maximumQuizGrade="100" checkboxGradingMethod="Individual"
timer="On">

</mgiToken>

The following is an example format file:

<form method="post" action="process.html">

<table>
<tr><td align="right">First Name:</td><td>
<input type="text" name="First Name"></td></tr>
<tr><td align="right">Last Name:</td><td>
<input type="text" name="Last Name"></td></tr>
<tr><td align="right">Student ID:</td><td>
<input type="text" name="ID"></td></tr>
</table>

<p><hr><p>

<u>You want to check the odor of a chemical.  You should:</u><br>
<br><input type="radio" name="odor" value="Sniff Directly">
A. Sniff directly out of the flask
<br><input type="radio" name="odor" value="Waft Gently" checked>
B. Waft gently over the flask toward your nose
<br><input type="radio" name="odor" value="Drink">
C. Drink some of it first

<p><hr><p>

<u>What element has an atomic number of 1?</u><br>
<br><input type="radio" name="Atomic Number" value="Helium">A. Helium
<br><input type="radio" name="Atomic Number" value="Hydrogen">B. Hydrogen
<br><input type="radio" name="Atomic Number" value="Uranium">C. Uranium

<p><hr><p>

<u>Which of the following elements are present in hydrogen peroxide? 
(Check all that apply.)</u><br>

<br><input type="checkbox" name="Peroxide" value="Hydrogen" checked>A. Hydrogen 
<br><input type="checkbox" name="Peroxide" value="Neon">B. Neon
<br><input type="checkbox" name="Peroxide" value="Nitrogen">C. Nitrogen
<br><input type="checkbox" name="Peroxide" value="Oxygen" checked>D. Oxygen

<p><hr><p>

<u>What is the chemical symbol for Lead?</u><br>
<br><select name="Lead">
	<option>Ld
	<option>Pb
	<option>Dr
</select>

<p><hr><p>

<input type="submit" name="button" value="Submit Quiz">

</form>

The Processing Page:

The processing page records each quiz and stores the information in the specified database and table. The processing page should contain the mgiQuiz tag exactly as it appears on the quiz page (see example code below). Since the quiz processing is invisible to the quiz-taker, the processing page can also display a message to the quiz-taker such as "Thank You. Your quiz has been received."

<mgiToken>

<mgiQuiz databaseFileLocation="Chemistry"
tableName="Quiz1" formatFileLocation="quiz1format.txt"
maximumQuizGrade="100" checkboxGradingMethod="Individual"
timer="On">

</mgiToken>

The Admin Page:

The admin page allows the quiz administrator to view, search and export quiz scores. If you are timing quizzes, you must include the "timer" parameter to view the elapsed time of each quiz in the administration interface:

<mgiQuiz databaseFileLocation="Chemistry" mode="Admin" timer="On">

Taking Quizzes:

After creating the entry, quiz, processing, and admin pages, the administrator should take the quiz once and input all correct answers. That quiz will become the first record in the specified database table and will be used as the key to grade all subsequent quiz submissions. After the key has been entered, other users can take and submit quizzes. After it is submitted, each quiz will be automatically graded based on the key and scored according to the parameters that are entered in the mgiQuiz tag. Quiz scores can be viewed, searched, or exported on the admin page.


Suggested Usage

  • Online Quizzes


[Return to the Referencing MGI Menu]


[User Guide Main Menu] [Understanding MGI Menu] [Using MGI Menu] [Referencing MGI Menu]