Referenceanswer (Advanced Use)

<answer>

Advanced Use Examples

The following examples illustrate some of the advanced answer forms.

Designating Responses

When using the full logic of an <award> tag, the expression inside the <when> can refer to components outside the <answer> tag. However, in this case, Doenet cannot tell what values should be considered the response of that answer. When basing an answer on inputs outside the <answer> tag, you must indicate what values are to be used for the responses. There are two ways to tell Doenet that a value is a response: adding a referencesAreResponses attribute to the <award>, or adding a <considerAsResponses> child to the <award>.

The response of an answer is what the user entered to be evaluated for credit. For a typical answer, the response is what the user entered in the blank or selected from a lists of choices. Doenet always uses any input tag (e.g., <mathInput/>, <textInput>, <choiceInput/>) inside the <answer> tag for the response. Any other value referenced inside a <when> is not considered a response, by default.

Although answer responses do not affect the credit awarded, they are used for the data analytics and giving feedback to instructors and authors. They can also be referenced inside the DoenetML document to create dynamic content that depends on the user’s response. Every answer should have some values flagged as the responses.

See the examples below for how to use each of these methods to designate a response.

Example: using the referencesAreResponses attribute in the <award>

In this example, the referencesAreResponses attribute is used in the <award> tag to indicate that $fPrime.styleNumber is the response for this answer.

When this attribute is not included, both $f.styleNumber and $fPrime.styleNumber are considered responses, which could lead to confusion when analyzing the collected data.

Example: using <considerAsResponses> to designate responses

In this example, the <considerAsResponses> tag is used to indicate that the coordinates of point $P is the response for this answer.

When the <considerAsResponses> child is not included, all four values $P.x, $P.y, $x, and $y are considered responses, which is not desirable in this case.