## WeBWorK Problems

### Custom error message when student enters "dne" ?

by Chris Wingard -
Number of replies: 2

Hi All,

I'm wondering if there's a way to give a custom error message when a student enters DNE as an answer.  For example, we have a limit problem in our calc 1 course where students calculate both one-sided limits and then calculate the two-sided limit (or enter DNE).

In this particular problem, the limit does exist and I have this custom checker:

ANS( $ans1 -> cmp( checker => sub { my ($correct,$student,$anshash) = @_;

###  THIS LINE MAKES SURE THE ANSWER BOX ISN'T BLANK
return 0 unless $anshash->{original_student_ans} =~ /~~S/; Value::Error("Hint: Are your answers to the previous two parts equal?") if ($correct != $student); return ($correct == $student); })->withPreFilter('erase')->withPostFilter('erase'));$ans1 has a numeric value.  If the student enters any incorrect numeric value, the hint/message is displayed.  But if the student enters "dne", the message is not displayed.  Is there something I can do to display a message when a student enters "dne"?  Thanks!

-- C

### Re: Custom error message when student enters "dne" ?

by Arnold Pizer -
Hi,

One way to do this is with answerHints.  Look at http://webwork.maa.org/wiki/AnswerHints and