MDL-26281 Lesson - Fixed short answer with apostrophe and other html formats
authorRajesh Taneja <rajesh@moodle.org>
Tue, 21 Jun 2011 05:31:32 +0000 (13:31 +0800)
committerRajesh Taneja <rajesh@moodle.org>
Wed, 22 Jun 2011 09:17:55 +0000 (17:17 +0800)
mod/lesson/pagetypes/shortanswer.php

index 821d614..9e5c0f5 100644 (file)
@@ -73,7 +73,6 @@ class lesson_page_type_shortanswer extends lesson_page {
             $result->noanswer = true;
             return $result;
         }
-        $studentanswer = s($studentanswer);
 
         $i=0;
         $answers = $this->get_answers();
@@ -163,7 +162,9 @@ class lesson_page_type_shortanswer extends lesson_page {
                 break; // quit answer analysis immediately after a match has been found
             }
         }
-        $result->studentanswer = $result->userresponse = $studentanswer;
+        $result->userresponse = $studentanswer;
+        //clean student answer as it goes to output.
+        $result->studentanswer = s($studentanswer);
         return $result;
     }