TEG Quiz “Who Am I?” Plugin
Part of the TEG Quiz Library. This plugin provides the functionality necessary for the TEG Quiz Library to run an identity style quiz.
Requires
Properties
|
Property
|
Type
|
Default
|
Description
|
| options |
Collection |
See Options below. |
A collection of options for configuring the quiz. |
Methods
|
Method
|
Description
|
| getResults() |
Counts the number of answers in each category and returns the winning entry from options.categories below.
|
Options
|
Option
|
Type
|
Default
|
Description
|
| questions |
jQuery Object |
[] |
A jQuery object containing the quiz questions. |
| categories |
Collection |
{} |
A collection of objects representing the categories to assign a survey taker. Each key name should match the
value attribute of the answers. The members of each entry must include a number value named
count and a string value named win. The
count value will track the number of answers for that category. The
win value will be displayed to the user. See the
resultSelector option of TEG Query Library.
|
Category Example
<input type="radio" name="radioGroup" id="radio01" value="category01" /> <label for="radio01">Category 01</label>
<input type="radio" name="radioGroup" id="radio02" value="category02" /> <label for="radio01">Category 02</label>
{
'category01': {
count: 0,
win : 'You are in "Category 01!"',
},
'category02': {
count: 0,
win : 'You are in <strong>“Category 02!”</strong>',
},
}
|
Option
|
Type
|
Default
|
Description
|
| answers |
Collection |
{} |
A collection of CSS selectors and category assignments. If the form cannot be configured with a value matching the keys in the
categories collection then the selectors in this collection will be used to assign each question to the proper category.
|
Answer Example
{
'CSS Selector 01': 'category01',
'CSS Selector 02': 'category02',
}
|
Option
|
Type
|
Default
|
Description
|
| submitQueue |
Collection of Functions |
{
// override the default submit handler for all quiz types
'00500_quizHandler': function(event) {
if (console) {
console.warn('TQWhoAmI.options.submitQueue[\'00500_quizHandler\'] not overridden as expected.');
} // end if console available
return true;
} // end ['00500_quizHandler']()
}
|
A collection of functions added to the submitQueue option of TEG Query Library. |
| errorQueue |
Collection of Functions |
{
// override the default error handler for all quiz types
'00500_quizErrorHandler': function() {
if (console) {
console.warn('TQWhoAmI.options.errorQueue[\'00500_quizErrorHandler\'] not overridden as expected.');
} // end if console available
return true;
} // end ['00500_quizErrorHandler']()
}
|
A collection of functions added to the errorQueue option of TEG Query Library. |