new TextChoiceFieldStep(tpl, result, end_message, options) → {Object}
Exercises - Text plus one radio input
Parameters:
Name | Type | Argument | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tpl |
String | The exercise template. The math to be parsed by mathjax must be placed inside the tag {%%}, i.e. {% 2^4=16 %} The available choices must be written this way: [[0]] my choice. Then the [[0]] is parsed and a radio buton is created. |
|||||||||||
result |
Number | The index of the correct radio answer | |||||||||||
end_message |
String |
<optional> |
A message to be displayed at the end of the step | ||||||||||
options |
Object |
<optional> |
The step options
Properties
|
- Source:
- mathex/res-otto/js/mathex.js, line 814
Returns:
TextChoiceFieldStep instance
- Type
- Object
Example
var step = new mathex.TextChoiceFieldStep(
'<h3>Title</h3>' +
'<p>Which color is yellow?</p>' +
'<ul>' +
'<li>[[0]] red</li>' +
'<li>[[1]] {% 2^7 = 32 %}</li>' +
'<li>[[2]] yellow</li>' +
'</ul>',
2
);
Extends
Methods
-
addInputEvents()
Adds events to the radio buttons
-
- Source:
- mathex/res-otto/js/mathex.js, line 890
Returns:
void -
checkChoiceFieldResult(field, id)
Checks the user answer
-
Parameters:
Name Type Description field
Object The mootools radio button object id
Number The index of the clicked radio button - Source:
- mathex/res-otto/js/mathex.js, line 846
Returns:
void -
checkFieldResult(field, result, fieldobj)
Checks the result of a text field
-
Parameters:
Name Type Description field
Object The mootools input field object result
Mixed The right result fieldobj
Object The input object - Inherited From:
- Source:
- mathex/res-otto/js/mathex.js, line 616
-
deactivate()
Deactivates all inputs
-
- Source:
- mathex/res-otto/js/mathex.js, line 918
Returns:
void -
removeInputEvents()
Removes events from the radio buttons
-
- Source:
- mathex/res-otto/js/mathex.js, line 905
Returns:
void -
run(router)
Executes the step
-
Renders the template and activates radio buttons
Parameters:
Name Type Description router
Object a mathex.Router instance - Source:
- mathex/res-otto/js/mathex.js, line 817
Returns:
void