<answer>
Attribute Examples Part 2
The following examples illustrate use of the <answer> tag attributes.
Attributes
| Attribute | Type | Values |
|---|---|---|
allowedErrorInNumbers = "…" | number | |
allowedErrorIsAbsolute = "…" | boolean | "true" "false" |
caseInsensitiveMatch = "…" | boolean | "true" "false" |
creditByAttempt = "…" | numberList | |
disableAfterCorrect = "…" | boolean | "true" "false" |
disableWrongChoices = "…" | boolean | "true" "false" |
displayDigitsForCreditAchieved = "…" | integer | |
displayDigitsForResponses = "…" | integer | |
expanded = "…" | boolean | "true" "false" |
expandOnCompare = "…" | boolean | "true" "false" |
forceFullCheckworkButton = "…" | boolean | "true" "false" |
handGraded = "…" | boolean | "true" "false" |
includeErrorInNumberExponents = "…" | boolean | "true" "false" |
inline = "…" | boolean | "true" "false" |
matchBlanks = "…" | boolean | "true" "false" |
matchByExactPositions = "…" | boolean | "true" "false" |
matchPartial = "…" | boolean | "true" "false" |
maxNumAttempts = "…" | integer | |
numAwardsCredited = "…" | integer | |
numPeriodicSetMatchesRequired = "…" | integer | |
numSignErrorsMatched = "…" | number | |
parseScientificNotation = "…" | boolean | "true" "false" |
preserveLastChoice = "…" | boolean | "true" "false" |
selectMultiple = "…" | boolean | "true" "false" |
showCorrectness = "…" | "true" "false" | |
shuffleOrder = "…" | boolean | "true" "false" |
simplifyOnCompare = "…" | text | "none" "full" "numbers" "numberspreserveorder" |
splitSymbols = "…" | boolean | "true" "false" |
submitLabel = "…" | text | |
submitLabelNoCorrectness = "…" | text | |
symbolicEquality = "…" | boolean | "true" "false" |
type = "…" | ||
unorderedCompare = "…" | boolean | "true" "false" |
weight = "…" | number |
Example: maxNumAttempts
The maxNumAttempts attribute may be used to limit the number of attempts
on a question-by-question basis.
Example: allowedErrorInNumbers
The allowedErrorInNumbers attribute may be used to specify a tolerance on numerical values that are considered to be correct.
If the answer includes variables as well as numbers, using the symbolicEquality attribute will typically give more precise behavior.
By default, the error tolerance is specified as a fraction of the absolute value of the correct response.
The allowedErrorIsAbsolute attribute will change the tolerance to be specified as an absolute number.
Example: allowedErrorIsAbsolute
To specify an allowed error with a specific numerical value (rather than as a fraction of the correct response),
use the allowedErrorIsAbsolute attribute in combination with the allowedErrorInNumbers attribute.
Example: includeErrorInNumberExponents
By default, allowedErrorInNumbers does not apply to exponents
so that is not considered within 1% of . To allow error in such
exponents, add the includeErrorInNumberExponents attribute, preferably with the symbolicEquality attribute.
Example: caseInsensitiveMatch
Use the caseInsensitiveMatch attribute if capitalization is not relevant for validation.
Example: showCorrectness
The showCorrectness attribute may be used to hide the validation of individual questions for assessments.
The default behavior is to show correctness unless either the handGraded attribute was
specified or we are in assignment where the Show Correctness setting has been set to false.
The showCorrectness attribute on <answer> will override these settings to either
always show or never show correctness.
Example: type=“text”
The type attribute of <answer> is needed in a few cases to switch the answer to text mode
when it cannot be inferred. In text mode, the response must match
exactly with only whitespace difference at the beginning or end. See caseInsensitiveMatch for one
way to relax this requirement.
Example: disableAfterCorrect
The disableAfterCorrect attribute can be used to render <answer> components disabled after credit is achieved.
Example: submitLabel
The submitLabel attribute can be used to create a custom label for the “Check Work” button.
Example: submitLabelNoCorrectness
The submitLabelNoCorrectness attribute modifies the standard
“Submit Response” button label for answers where it is not desired to show correctness.
Example: selectMultiple
The selectMultiple attribute allows multiple <choice> components to be selected for response.
Example: shuffleOrder
The shuffleOrder will create different variants of the document with the choices rendered in different orders.
Due to the algorithm used to generate these variants, the displayed variant may display the choices in the original order if there are fewer than 5 choices.
Example: splitSymbols
By default, an <answer> will split multiple characters entered into the
product of single character variables (unless the combination contains a non-leading number).
Setting splitSymbols to false will turn off this splitting so that variables in a
product must be separated by a space or a multiplication symbol.
Example: expanded
The expanded attribute renders an expanded text box for answers with type="text".
Example: displayDigitsForResponses
The displayDigitsForResponses determines how many digits are displayed when
referencing the users responses of the answer.
The default value is 10 digits.
Example: displayDigitsForCreditAchieved
The displayDigitsForCreditAchieved determines how many digits are displayed when referencing
the creditAchieved property of the answer.
The default value is 3 digits.
Example: matchBlanks
If a mathematical expression is incomplete, such as <math>3+()</math>, it may contain blanks that
are rendered by an underscore or a gray square. Since such blanks typically indicate an error in a
mathematical expression, any expression with a blank will, by default, never match a correct answer.
To valid as correct a response that includes a blank, add the matchBlanks attribute to the <answer>.