Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 1.6.2
-
Fix Version/s: None
-
Component/s: Quiz
-
Labels:None
-
Environment:Linux, PHP 5.0.4, MySQL 4.1.20, Apache 2.0.54, Moodle latest 1.6.2+
-
Affected Branches:MOODLE_16_STABLE
Description
If an apostrophe (ASCII character 39) is entered into a short answer field of a multianswer (cloze) question, and the answer is then either submitted individually (using the adaptive mode) OR saved without submitting with other answers displayed on a quiz page, there is a backslash character inserted in front of the apostrophe each time the quiz page is reloaded.
Example:
[SHORTANSWER FIELD]: Boys' Orchestra
- Save without submitting (1)
[SHORTANSWER FIELD]: Boys\' Orchestra - Save without submitting (2)
[SHORTANSWER FIELD]: Boys\\\' Orchestra - Save without submitting (3)
[SHORTANSWER FIELD]: Boys\\\\\\\' Orchestra
What I did was to add a stripslashes() into the question\type\multianswer\questiontype.php file – as shown below. I do not know though whether I should consider this solution systematic or robust enough. ![]()
— ORIGINAL question\type\multianswer\questiontype.php Sat Sep 23 16:52:53 2006
+++ MODIFIED question\type\multianswer\questiontype.php Sat Sep 23 17:35:33 2006
@@ -304,7 +304,7 @@
case 'shortanswer':
case 'numerical':
echo " <input $style $readonly $popup name=\"$inputname\"
- type=\"text\" value=\"$response\" size=\"12\" /> ";
+ type=\"text\" value=\"".stripslashes($response)."\" size=\"12\" /> ";
break;
case 'multichoice':
$outputoptions = '<option></option>'; // Default empty option
Issue Links
| This issue duplicates: | ||||
| MDL-6386 | Apostrophe problem in SHORTANSWER question embedded inside CLOZE question |
|
|
|
If the answer containing an apostrophe is simply submitted for the first time (wihout using adaptive mode or saving it without submitting), then a backslash appears in front of the apostrophe on the review page.