From: pichetp Date: Thu, 14 Aug 2008 09:39:22 +0000 (+0000) Subject: better validation of null answers MDL-8475 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=f7443920c87e0c6771899378a7ee9da6ca28555e;p=moodle.git better validation of null answers MDL-8475 --- diff --git a/question/type/numerical/edit_numerical_form.php b/question/type/numerical/edit_numerical_form.php index dc61ee19e8..62b7923ac9 100644 --- a/question/type/numerical/edit_numerical_form.php +++ b/question/type/numerical/edit_numerical_form.php @@ -124,6 +124,14 @@ class question_edit_numerical_form extends question_edit_form { if ($data['fraction'][$key] == 1) { $maxgrade = true; } + } else { + if ($data['fraction'][$key] !=0 || trim($data['feedback'][$key]) != ''){ + $errors["answer[$key]"] = get_string('answermustbenumberorstar', 'qtype_numerical'); + $answercount++; + if (trim($data['feedback'][$key]) != ''){ + $errors["feedback[$key]"]=get_string('feedback','quiz').'='.htmlspecialchars(trim($data['feedback'][$key])); + } + } } } if ($answercount==0){