Referenceanswer (Properties)

<answer>

The following examples illustrate use of the <answer> tag properties.

Properties

Properties for <answer name="a">

Highlighted (2)
$a.inline

boolean. Whether to render the answer's input inline rather than as a block.

$a.symbolicEquality

boolean. Whether comparison uses symbolic equality (rather than numeric evaluation).

Labels (2)
$a.label

label. The label rendered with this component.

$a.labelIsName

boolean. Whether to use this component's name as its rendered label.

Answer grading (9)
$a.disableAfterCorrect

boolean. Whether to disable the answer after a fully correct response has been submitted.

$a.displayDigitsForCreditAchieved

integer. Number of significant digits to display for the credit achieved value.

$a.displayDigitsForResponses

integer. Number of significant digits to display when rendering numeric responses.

$a.handGraded

boolean. Whether this answer is graded by hand rather than automatically.

$a.matchPartial

boolean. Whether to award partial credit when the response is partially correct.

$a.maxNumAttempts

integer. Maximum number of times the response can be submitted.

$a.submitLabel

text. Label for the submit button when correctness is shown.

$a.submitLabelNoCorrectness

text. Label for the submit button when correctness is not shown.

$a.weight

number. Relative weight of this answer when aggregating credit across multiple answers.

Other (41)
$a.allowedErrorInNumbers

number. Maximum allowed numeric error when comparing numbers (relative or absolute).

$a.allowedErrorIsAbsolute

boolean. Whether allowedErrorInNumbers is interpreted as an absolute (rather than relative) tolerance.

$a.caseInsensitiveMatch

boolean. Whether text comparisons ignore letter case.

number. The fraction of credit achieved on the most recent submission (between 0 and 1).

$a.creditByAttempt

numberList. Per-attempt credit multipliers (e.g. "1 0.7 0.5" for full/70%/50% on attempts 1/2/3+).

$a.currentResponse

The current (unsubmitted) response value from the answer's first input.

The current (unsubmitted) response values from this answer's inputs.

$a.disabled

boolean. Whether this answer is disabled and is no longer accepting submissions.

$a.disableWrongChoices

boolean. Whether incorrect choices are disabled after being submitted.

$a.expanded

boolean. Whether the answer's submitted-response panel is expanded by default.

$a.expandOnCompare

boolean. Whether to expand math expressions before comparing them.

[ feedback ]. The feedback messages produced by matched awards or applicable feedback definitions.

$a.fixed

boolean. Whether this component's value is fixed and cannot be modified.

$a.fixLocation

boolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).

$a.focused

boolean. Whether any input within this answer currently has keyboard focus.

$a.forceFullCheckWorkButton

boolean. Whether to always render a full-size check-work button.

$a.forceSmallCheckWorkButton

boolean. Whether to always render a small check-work button.

$a.hidden

boolean. Whether this component is hidden from the rendered output.

$a.includeErrorInNumberExponents

boolean. 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.matchBlanks

boolean. Whether unfilled blanks in a math expression count as a match.

$a.matchByExactPositions

boolean. Whether to match list responses by exact position rather than by content.

integer. Remaining number of submission attempts before the maximum is reached.

$a.numAwardsCredited

integer. Maximum number of matching awards whose credits are summed.

$a.numFeedbacks

number. The number of feedback messages produced by matched awards or applicable feedback definitions.

$a.numPeriodicSetMatchesRequired

integer. Number of consecutive elements of a periodic set required to count as a match.

number. The number of current (unsubmitted) response values from this answer's inputs.

$a.numSignErrorsMatched

number. 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.parseScientificNotation

boolean. Whether to parse expressions like 1e3 as scientific notation.

$a.preserveLastChoice

boolean. 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.selectMultiple

boolean. For choice answers: whether multiple choices may be selected.

$a.showPreview

boolean. Whether to display a preview of the response as the student types.

$a.shuffleOrder

boolean. For choice answers: whether to display choices in randomized order.

$a.simplifyOnCompare

text. Level of simplification applied to math expressions before comparing them.

$a.splitSymbols

boolean. Whether multi-character symbols should be split into a product of single-character variables when parsing.

$a.submittedResponse

The first response value from the most recent submission.

The response values from the most recent submission.

$a.unorderedCompare

boolean. Whether order is ignored when comparing list-like responses.

Common to all components (4)
$a.doenetML

text. The DoenetML source code that produced this component.

$a.hide

boolean. Whether to hide this component from the rendered output.

$a.isResponse

boolean. Whether this component is treated as a response for the purposes of assessment.

$a.styleNumber

integer. 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.