Cloze Question - JavaScript / Feedback

Cloze Question - JavaScript / Feedback

by Ali Shah -
Number of replies: 6

Hi

For Cloze questions, moodle displays a tooltip / pop-up for users to gain feedback after the quiz has been marked. I have two problems regarding this.

1) Firslty moodle makes of JavaScript (I think) to display this tooltip. Is there any way of forcing the feedback to be written into the body of the page. This is because not all internet users have JavaScript enabled within their browsers.

2) When viewing the tooltip for feedback, if there is a field / question immediatley below the one you are hovering over, the field immediately below appears above the tooltip. Is there a way around around this problem ? This is shown below:

  pic

Thanks

 

Average of ratings: -
In reply to Ali Shah

Re: Cloze Question - JavaScript / Feedback

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
I do not get this problem on my Moodle installation. Which Moodle version are you using? which theme? which browser?
I'm using Moodle 1.6, Firefox and my own orangechoc theme.
See attached screen shot showing pop-up feedback tooltip displayed over the fields.
Joseph
Attachment image-0000.jpg
In reply to Joseph Rézeau

Re: Cloze Question - JavaScript / Feedback

by Ali Shah -

Hi Joseph

I am using Moodle version 1.5.4 and using IE 6.0 as my browser. Also the theme I am using is called GreenShade15, which downloaded from the following website: http://www.ballisticlearning.biz/moodlethemes/index.php?option=com_content&task=view&id=34&Itemid=35

I have also tried this in Firefox, and appears OK, therefore the problem is within IE 6.0.

Also please can you tell me if it is possible to have the feeback rendered into the body of the HTML page, rather than a JavaScript popup, as I am worried, there may be users who do not have JavaScript enabled within their browsers.

Thanks. 

In reply to Ali Shah

Re: Cloze Question - JavaScript / Feedback

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Ali,
There is indeed a display bug for the feedback popup window in MSIE 6.0. I have posted a solution in bug #6057. See the result in attached screen shot.
Joseph
Attachment image-0000.jpg
In reply to Ali Shah

Re: Cloze Question - JavaScript / Feedback

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

As for displaying the feedback in the body of the HTML page, yes, it is possible, if you hack the Moodle code just a little. However, the crude solution I am suggesting causes the feedback message to be displayed immediately after each question, which means it intrudes with the rest of the text, if there is any. See attached screen shot (which shows both javascript-enabled popup feedback and feedback included in text as per modifications show below).

modifications to:

  • Moodle 1.5.4 file \mod\quiz\questiontypes\multianswer\questiontype.php
  • Moodle 1.6 file \question\type\multianswer\questiontype.php

around line 300, add the instructions in red.

            // Print the input control
            switch ($wrapped->qtype) {
                case 'shortanswer':
                case 'numerical':
                    echo (" <input $style $readonly $popup name=\"$inputname\"
                            type=\"text\" value=\"$response\" size=\"12\"/><strong>".$feedback."</strong>");
                    break;
                case 'multichoice':
                    $outputoptions = '<option></option>'; // Default empty option
                    foreach ($answers as $mcanswer) {
                        $selected = $response == $mcanswer->id
                                ? ' selected="selected" ' : '';
                        $outputoptions .= "<option value=\"$mcanswer->id\" $selected>$mcanswer->answer</option>";
                    }
                   echo "<select $popup $readonly $style name=\"$inputname\">";
                   echo $outputoptions;
                   echo ('</select><strong>'.$feedback.'</strong>');
                   break;
               default:
                   error("Unable to recognize questiontype ($wrapped->qtype) of
                          question part $positionkey.");
                   break;
           }

Joseph

Attachment image-0000.jpg
In reply to Joseph Rézeau

Re: Cloze Question - JavaScript / Feedback

by Ali Shah -

Joseph

That works great - Thanks for that (Sorry for the late response)

Now that I have the feedback embedded in the page / body itself - is there anyway of turning off the javascript-enabled popup feedback, as this becomes anoying, if the feeback is already printed in body. I had a look in ...mod/quiz/attempt.php and also \question\type\multianswer\questiontype.php, but could not find it.

Thanks.

 

In reply to Ali Shah

Re: Cloze Question - JavaScript / Feedback

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Ali,
in Moodle 1.5.4 file \mod\quiz\questiontypes\multianswer\questiontype.php
around line 265, comment out:
// $popup = " onmouseover=\"return overlib('$feedback', CAPTION, '$strfeedback', FGCOLOR, '#FFFFFF');\" "." onmouseout=\"return nd();\" ";