<feedbackDefinition>
<feedbackDefinition> defines a reusable feedback string keyed by a
code. Authors place one or more <feedbackDefinition> elements in a
<setup> block, then reference them by code from <award>
elements (via the feedbackCodes attribute). When that award is achieved,
the matching feedback text becomes available on the answer’s feedbacks
property (and on the award’s own feedback).
The author must then render the feedback in the desired location by
referencing one of those properties — <answer> is an inline component
and DoenetML cannot infer where to place the block-level feedback on its
own. Typical pattern: put $ans.feedbacks in a paragraph or block right
after the <answer>. Without that reference, the feedbackCodes
match has no visible effect.
This separates what feedback is shown from what triggers it. The same
code can be reused across many problems, and per-section overrides are
respected: a <feedbackDefinition> inside a nested <setup> shadows
one defined further up the tree. Code matching is case-insensitive.
Attributes and Properties
Attributes for <feedbackDefinition>
Other (2)
Common to all components (9)
copyreference. Create an independent copy of another component by reference. Enter a references a $name.
disabledboolean. Default value: false. Whether this component is disabled and cannot be interacted with.
extendreference. Extend another component by reference, inheriting its children and attributes. Enter a reference as $name.
fixedboolean. Default value: false. Whether this component's value is fixed and cannot be modified.
fixLocationboolean. Default value: false. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
hideboolean. Default value: false. Whether to hide this component from the rendered output.
isResponseboolean. Default value: false. Whether this component is treated as a response for the purposes of assessment.
nametext. The name used to reference this component from elsewhere in the document.
styleNumberinteger. Default value: 1. The style number used to select this component's visual styling from the available style definitions.
Properties for <feedbackDefinition name="f">
Other (4)
$f.disabledboolean. Whether this component is disabled and cannot be interacted with.
$f.fixedboolean. Whether this component's value is fixed and cannot be modified.
$f.fixLocationboolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
Common to all components (4)
$f.doenetMLtext. The DoenetML source code that produced this component.
$f.hideboolean. Whether to hide this component from the rendered output.
$f.isResponseboolean. Whether this component is treated as a response for the purposes of assessment.
$f.styleNumberinteger. The style number used to select this component's visual styling from the available style definitions.
Built-in feedback codes
Four feedback codes are pre-defined and available without any
<feedbackDefinition>. Reference them from
<award feedbackCodes="…"> (or <choice feedbackCodes="…">)
exactly like author-defined codes; the lookup is case-insensitive, so
goodJob, GOODJOB, and goodjob all match the same entry.
| Code | Default text |
|---|---|
goodJob | Good job! |
numericalError | Credit reduced because numbers in your answer weren’t quite right. Did you round too much? |
oneSignError | Credit reduced because it appears that you made a sign error. |
twoSignErrors | Credit reduced because it appears that you made two sign errors. |
A document- or section-scoped <feedbackDefinition> may shadow any of
these by reusing the same code — see “Override feedback per section”
below. Scoping is by ancestor: a shadow inside one section affects only
that section’s descendants, so sibling sections still see the built-in
defaults.
Examples
Example: Define and use feedback by code
Each <award> names a feedback code via feedbackCodes. When
that award is matched, the text from the matching <feedbackDefinition>
becomes available on $ans.feedbacks; rendering that reference (here in a
paragraph below the answer) is what actually shows the feedback to the
learner. (The code goodJob is one of the four built-in codes listed
above, so it does not need its own
<feedbackDefinition>.)
Example: Override feedback per section
The second problem’s local <feedbackDefinition> overrides the
document-level one, so the same rounded code produces different feedback
text in each problem. Each <problem> renders its own answer’s
feedbacks reference so the correct text appears in context.
Attribute Examples
Attribute Example: code, text
code is the case-insensitive lookup key referenced from
<award feedbackCodes="...">; text is the feedback string the
referenced answer’s feedbacks property delivers (here rendered just below
the answer).