<answer>
The following examples illustrate use of the <answer> tag properties.
Properties
Properties for <answer name="a">
Highlighted (2)
$a.inlineboolean. Whether to render the answer's input inline rather than as a block.
$a.symbolicEqualityboolean. Whether comparison uses symbolic equality (rather than numeric evaluation).
Labels (2)
$a.labellabel. The label rendered with this component.
$a.labelIsNameboolean. Whether to use this component's name as its rendered label.
Answer grading (9)
$a.disableAfterCorrectboolean. Whether to disable the answer after a fully correct response has been submitted.
$a.displayDigitsForCreditAchievedinteger. Number of significant digits to display for the credit achieved value.
$a.displayDigitsForResponsesinteger. Number of significant digits to display when rendering numeric responses.
$a.handGradedboolean. Whether this answer is graded by hand rather than automatically.
$a.matchPartialboolean. Whether to award partial credit when the response is partially correct.
$a.maxNumAttemptsinteger. Maximum number of times the response can be submitted.
$a.submitLabeltext. Label for the submit button when correctness is shown.
$a.submitLabelNoCorrectnesstext. Label for the submit button when correctness is not shown.
$a.weightnumber. Relative weight of this answer when aggregating credit across multiple answers.
Other (41)
$a.allowedErrorInNumbersnumber. Maximum allowed numeric error when comparing numbers (relative or absolute).
$a.allowedErrorIsAbsoluteboolean. Whether allowedErrorInNumbers is interpreted as an absolute (rather than relative) tolerance.
$a.caseInsensitiveMatchboolean. Whether text comparisons ignore letter case.
number. The fraction of credit achieved on the most recent submission (between 0 and 1).
$a.creditByAttemptnumberList. Per-attempt credit multipliers (e.g. "1 0.7 0.5" for full/70%/50% on attempts 1/2/3+).
$a.currentResponseThe current (unsubmitted) response value from the answer's first input.
The current (unsubmitted) response values from this answer's inputs.
$a.disabledboolean. Whether this answer is disabled and is no longer accepting submissions.
$a.disableWrongChoicesboolean. Whether incorrect choices are disabled after being submitted.
$a.expandedboolean. Whether the answer's submitted-response panel is expanded by default.
$a.expandOnCompareboolean. Whether to expand math expressions before comparing them.
$a.feedbacks[ feedback ]. The feedback messages produced by matched awards or applicable feedback definitions.
$a.fixedboolean. Whether this component's value is fixed and cannot be modified.
$a.fixLocationboolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
$a.focusedboolean. Whether any input within this answer currently has keyboard focus.
$a.forceFullCheckWorkButtonboolean. Whether to always render a full-size check-work button.
$a.forceSmallCheckWorkButtonboolean. Whether to always render a small check-work button.
$a.includeErrorInNumberExponentsboolean. Whether the allowed numeric error also applies to numbers in exponents.
boolean. Whether the most recent submission for this answer has not yet been changed.
$a.matchBlanksboolean. Whether unfilled blanks in a math expression count as a match.
$a.matchByExactPositionsboolean. Whether to match list responses by exact position rather than by content.
integer. Remaining number of submission attempts before the maximum is reached.
$a.numAwardsCreditedinteger. Maximum number of matching awards whose credits are summed.
$a.numFeedbacksnumber. The number of feedback messages produced by matched awards or applicable feedback definitions.
$a.numPeriodicSetMatchesRequiredinteger. Number of consecutive elements of a periodic set required to count as a match.
$a.numResponsesnumber. The number of current (unsubmitted) response values from this answer's inputs.
$a.numSignErrorsMatchednumber. Maximum number of sign errors that still count as a match.
integer. Total number of times a response has been submitted.
number. The number of response values from the most recent submission.
$a.parseScientificNotationboolean. Whether to parse expressions like 1e3 as scientific notation.
$a.preserveLastChoiceboolean. For choice answers: whether the last-rendered choice keeps its position when shuffling.
boolean. Whether a response has ever been submitted for this answer.
$a.selectMultipleboolean. For choice answers: whether multiple choices may be selected.
$a.showPreviewboolean. Whether to display a preview of the response as the student types.
$a.shuffleOrderboolean. For choice answers: whether to display choices in randomized order.
$a.simplifyOnComparetext. Level of simplification applied to math expressions before comparing them.
$a.splitSymbolsboolean. Whether multi-character symbols should be split into a product of single-character variables when parsing.
$a.submittedResponseThe first response value from the most recent submission.
The response values from the most recent submission.
$a.unorderedCompareboolean. Whether order is ignored when comparing list-like responses.
Common to all components (4)
$a.doenetMLtext. The DoenetML source code that produced this component.
$a.hideboolean. Whether to hide this component from the rendered output.
$a.isResponseboolean. Whether this component is treated as a response for the purposes of assessment.
$a.styleNumberinteger. The style number used to select this component's visual styling from the available style definitions.
Property Examples
Example: Attributes as properties 1
The <answer> attributes listed above are also accessible as properties.
Example: Attributes as properties 2
The <answer> attributes listed above are also accessible as properties.
Example: numResponses
The numResponses property of the named <answer> renders
the number of user-inputs, or the number of distinct response components considered when awarding credit.
Example: currentResponses
currentResponses is an array that could contain multiple values. Individual values
can be obtain with square brackets. For example, the second response can be accessed with currentResponses[2].
Example: numSubmittedResponses
In this example, the numSubmittedResponses property of the named <answer>
renders the number of responses that have been submitted for the answer. Once the “Check Work” button
has been clicked, this number does not change (even if the values submitted do change). A null response
also counts as a submitted response once the user has clicked the “Check Work” button.
Example: submittedResponses
submittedResponses is an array that could contain multiple values. Individual
values can be obtain with square brackets. For example, the second response can be accessed with submittedResponses[2].
Example: creditAchieved
Note: the creditAchieved property will always show the credit from the most recent
submission of the answer, even if assignment settings or due dates modify the actual credit awarded.
Example: responseHasBeenSubmitted
The responseHasBeenSubmitted property of a named <answer> component returns “true” if the
user has clicked the “Check Work” button and “false” otherwise.
Example: justSubmitted
The justSubmitted property of a named <answer> component returns “true” if the user
has clicked the “Check Work” button and has not changed the content. When the user modifies their answer,
the justSubmitted property turns to false.
Example: feedbacks
The feedbacks property renders any feedback that is defined within the <answer> itself.
To specify more customized feedback, use a <feedback> tag.
Example: numSubmissions
The numSubmissions property renders the number of times the student has clicked the “Check Work” button.
Example: numAttemptsLeft
The numAttemptsLeft property renders the remaining number of times the student can a response.
It is only relevant when the maxNumAttempts attribute is used.