\label{Answer_Display_Overview}
\index{answer display}
Answers are typically not displayed to the student when they submit an answer to a problem.
When the problem is assigned in a course, a parameter for the `answer date' can be set such that students will see answers displayed when they revisit the problem after that date. The answer date is distinct from the due date which can also be set when a problem is assigned. Note that an xml tag `postanswerdate' is also available if you want to display additional information besides the answer. The content in the xml tag is suppressed until after the answer date.
Suppose you want the answer displayed as soon as the student finishes the problem rather than waiting until
the answer date. For example, this may occur in a multipoint problem where you
want the students to see the correct answer for one part before proceding to the next part. If you would like the
computer answer to be displayed after the student answer is correct, or the maximum number
of tries has been reached, this can be achieved by setting the parameter \texttt{problemstatus} = answer. Using
the colorful editor, the parameter can be inserted WITHIN the problem part, but BEFORE the response tag (e.g.
\texttt{numericalresponse}). For example:
\begin{verbatim}
<part id="01">
<parameter name="problemstatus" id="11" type="string_problemstatus"
default="answer" description="Show Problem Status" />
<numericalresponse answer="$c" id="01a">
<!-- using no tolerance since exact integer is expected for answer -->
<textline readonly="no" spellcheck="none" />
</numericalresponse>
</part>
\end{verbatim}
The options for the problemstatus are: ``yes'' - shows correct or incorrect only;
``answer'' - shows computer answer as described above; ``no'' -
don't show correct/incorrect feedback; ``no\_feedback\_ever''- supresses all feedback.
If you want to provide additional explanation in addition to the answer as soon as
the maximum tries allowed for the part have been reached, include a conditional
block in the problem part, and set the condition for the part to evaluate to
true when the problem is either correct, no tries remain, or it is post-answer date.
To achieve this behavior, add a call to the LON-CAPA function \&check\_status(`partid')
for each part to the script block, and set a scalar to the value returned for each part, then use
that scalar in the conditional block, e.g.,
\begin{verbatim}
<script type="loncapa/perl">
# for part: a
$status_a = &check_status('a');
# other computations
</script>
<part id="a">
<block condition="$status_a">
<startouttext />
<br />
Some explanation text about the answer, $answer
<endouttext />
</block>
</part>
\end{verbatim}
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>