Dropdown box not working in Matching Questions

Dropdown box not working in Matching Questions

by Don Hazelwood -
Number of replies: 28

We are getting reports of an issue where the matching question type drop-down box inside of a quiz is not droping down. This is not a wide spread problem - but seems to have started this week.

At this point we have not been able to reproduce this behavior.

We're running 1.9.12.

Does anyone have any ideas?

Average of ratings: -
In reply to Don Hazelwood

Re: Dropdown box not working in Matching Questions

by David Bach -

We just began receiving such reports from learners this past Monday. All have been using Internet Explorer 9.

The standard matching with drop-down lists fails to show the choices in IE9. We're looking for a solution. We are also using Moodle 1.9.12.

We're hampered because our employer doesn't allow us to download IE9. We're attempting to work through that so we can confirm it really is an IE9 issue.

In reply to David Bach

Re: Dropdown box not working in Matching Questions

by Adrian Norman -

Hello we are having a similar problem. Using the latest version of Moodle 1.9. . Just getting reports of problems with matching questions from users using IE9.

I am in an environment I can't test with IE9.  But once I get home I will try to replicate the problem.

A

 

 

In reply to Don Hazelwood

Re: Dropdown box not working in Matching Questions

by Kim Salinas -
Picture of Testers

IE 9 definitely has issues with the quiz (dropdowns not working, unable to fill in the blank, etc.)

We have been encountering problems with Firefox as well not letting some of the radio buttons be selected in 1.9. Users are able to click the save without submit button and then can get the buttons to work, or they can use the arrow keys. Any suggestions?

Average of ratings: Useful (1)
In reply to Kim Salinas

Re: Dropdown box not working in Matching Questions

by Amanda Baxter -

We are running Moodle 1.9.5 and are having the same issues.  The matching questions and short answer questions are not allowing users to type the answer/get the drop down menu.  We have seen this problem with both Google Chrome and Internet Explorer.  Has there been a resolution found?  

The forum says not using a secure window but then says that did not fix the issue.  I am not familiar with PHP coding so I have not made any adjustments like the ones mentioned.  I do have a theme applied by our hosting company.  Could the theme really be the issue?

Do I have to upgrade to the new moodle to fix this? Or never have any question type other than multiple choice?  I must say, I'm very confused by most of the answers in this forum so I hope someone can help me.

Amanda

In reply to Don Hazelwood

Re: Dropdown box not working in Matching Questions

by Timothy Takemoto -

A new term has started a week ago and a small number of my students who are using Internet Explorer 9, are experiencing the same problem.  The options are not being displayed, i.e. the drop down box is not dropping down.

I have a lot of matching questions. If some students cant do them then I'll have to remove the whole lot alas.

I see that problems with drop down menus are not limited to moodle. Searching for "drop down menus" "Internet explorer 9"

The quick solution seems to be the "compatability" button to the right of the URL field as shown in the attached link. This is going to confuse a lot of people. Is there any other way?

Tim

Attachment IE9compatibility.jpg
In reply to Timothy Takemoto

Re: Dropdown box not working in Matching Questions

by Timothy Takemoto -

I am asking at the Microsoft Support Forums too.

In reply to Timothy Takemoto

Re: Dropdown box not working in Matching Questions

by Timothy Takemoto -

The only place I have seen that says that they have a fix for an IE drop down menu issue is this
http://www.prophotoblogs.com/forum/index.php?/topic/53-dropdown-menu-error-in-internet-explorer/

Where it is recommended to add the following Css

/* fix IE dropdown bug #266 */ #topnav li ul { margin-top:0\9 !important; } #topnav li ul ul, #topnav li ul ul ul { margin-top:1.85em\9 !important; }

the "topnav" would need to be changed, but perhaps a line like this, adding some top margin to the drop down list (?) to whatever part of the css that the quiz is using might work?

I don't think that the above is applicable since the quiz uses <select> and <option> tags

This is a bit of one of my quizes.

<div class="ablock clearfix">
  <table class="answer">
          <tr class="r0">
        <td width="1%" class="c0 text">
          matchword       </td>
        <td class="c1 control ">
          <select id="menuresp..." name="resp..." >
   <option value="0"
>Choose...</option>
   <option value="...">option1</option>
   <option value="...">option2</option>
   <option value="...">option3</option>
   <option value="...">option4</option>
   <option value="...">option5</option>
   <option value="...">option6</option>
   <option value="...">option7</option>
   <option value="...">option8</option>
   <option value="...">option9</option>
   <option value="...">option10</option>
</select>
        </td>
      </tr>

Another place that has a solution to a drop down menu related problem is
http://forums.asp.net/t/1694632.aspx/2/10
but that is for a javascript drop down menu but these moodle quiz drop down menus are really simple. They do not seem to use javascript.

Elsewhere  read that one does not need to push the "compatibility button" every time if one uses the tools menu compability mode selection. I know what this looks like in Japanese, but not English:
http://nihonbunka.com/docs/gokanhyouji.png

Tim

In reply to Timothy Takemoto

Re: Dropdown box not working in Matching Questions

by Timothy Takemoto -

I have uploaded a minimal dropdown menu here (the above html)
http://nihonbunka.com/docs/simple.htm
and it is displayed in IE9 even when not in compatibility mode.

So there must be a problem with the css or html also on the quiz page.

Maybe some sort of margin thing, where an element is not allowed to poke out of its own area (as a drop down box does)?

I see that compatibility button is remembered for at least the browser session so for the time being the button will have to do but in the longer term....I would be very grateful of a fix to the code (and patches since my moodle is prehistoric)

Tim

In reply to Timothy Takemoto

Re: Dropdown box not working in Matching Questions

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

The matching question does indeed just use completely ordinary <select> menus. I don't understand how your IE9 could get that wrong. The qtype works for us in IE9 (although we have encountered other problems with more complex code).

Which theme are you using? At least IE9 comes with reasonable developer tools. Do they help you shed any light on the issue.

In reply to Tim Hunt

Re: Dropdown box not working in Matching Questions

by Timothy Takemoto -

Thanks for your response Tim

Please note that it is not limited to one installation, or even just to moodle. There is mention of the problem in Blackboard installations too.
http://distancelearning.waubonsee.edu/?p=845
and at various places around the web.

That said, it may well be a css issue since the code itself (as above) displays fine on its own
http://nihonbunka.com/docs/simple.htm

My theme is a standard one with some minor modifications to the header and footer. I have uploaded the css here
http://nihonbunka.com/docs/styles.css
http://nihonbunka.com/docs/standard_styles.css

The actual code I am using is old
http://nihonbunka.com/docs/attempt.php
But please see the other posts above from September this year.

I will look into the developer tools. 

Tim 

In reply to Tim Hunt

Re: Dropdown box not working in Matching Questions

by Timothy Takemoto -

Dear Tim, Everyone

I started to try to use the "developer tools" to see for instance what css element the dropdown menu is in, but before I could do so I had to turn on the menu bar in the quiz window, and to do that I had to turn off the setting "Open quiz in a secure window."

When I did that I found that I was able to use the drop down menus. In other words, it is something to do with the secure window.

Finally, since the test that use drop down menus do not need to be in a secure window (I only put them there for consistency), my particular problem is solved.

But for everyone else, I presume that it is the secure window javascript that is somehow causing the problem. And hence, perhaps, the prevalence of education sites reporting this problem.

Tim

In reply to Timothy Takemoto

Re: Dropdown box not working in Matching Questions

by Timothy Takemoto -

The javascript is http://nihonbunka.com/docs/protect_js.txt

My solution for the time being is an SQL command:
 UPDATE moodle_quiz SET popup = 0 WHERE timelimit = 1

popup = 0 means that the quizes will not be in a secure window. This is all round good because I was using the matching questions only for vocab tests that have a one minute time limit. The need to say yes to the question "This page will affect the clipboard" was also a drag too.

But I wonder what it is about the javascript that screws things up. Even the bits that are not obfuscated look like they might.

Tim

In reply to Timothy Takemoto

Re: Dropdown box not working in Matching Questions

by Timothy Takemoto -

I thought that I had fixed the problem but now that I have put the test in a non "secure" window the submit the test button is being ignored, only in Internet Explorer 9, and only when the compatibility button is not being pressed.

So, when in a secure window the drop down menus were ignored, and when in a non secure window the submit button is being ignored.

Regular multiple choice questions are working fine.

There are reports of buttons not working in (non compatibility mode) elsewhere on the net.

I guess that IE9 is just being more strict about things.


Tim

In reply to Timothy Takemoto

Re: Dropdown box not working in Matching Questions

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Can you validate the HTML of the page that is cuasing the problem?

In reply to Tim Hunt

Re: Dropdown box not working in Matching Questions

by Timothy Takemoto -

Tim, yes good idea. Thank you. 
The man at the microsoft forums suggested the same thing and that is what I am doing now. There were some minor <br> to <br/> type things and other issues in my header mainly. I am correcting them slowly and will post the validation link later.

Tim

In reply to Timothy Takemoto

Re: Dropdown box not working in Matching Questions

by Timothy Takemoto -

Here is the attempt.php that is not working uploaded to a place outside my moodle
http://nihonbunka.com/docs/attempt.php

The problems in the validation seem quite serious especially the first.
http://validator.w3.org/check?uri=http%3A//nihonbunka.com/docs/attempt.php

No form tag? The form tag should be being written by the javascript at the top of the file.

A (possibly related?) problem is that the last line of the header displays correctly in IE9 but incorrectly in IE8 (inside or outside of my moodle).
Note that when I look at attempt.php
http://nihonbunka.com/docs/attempt.php
in IE9 the navbar/breadcumbs are pretty like this
displayed the right way
But in my older browser the background shading of the navbar/breadcrumbs disappears and is replaced with nasty white line
wrong way

So this may have something to do with a problem in my header.

But why should IE9 have the problem though it displays the header correctly?

It is all like magic to me.

Tim

In reply to Timothy Takemoto

Re: Dropdown box not working in Matching Questions

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Yes, I am suspicious that your theme is causing the problem, becuase I have not seen this problem myself.

In reply to Tim Hunt

Re: Dropdown box not working in Matching Questions

by Timothy Takemoto -

True, but please note that others above are experiencing similar problems.

But....a new line of attack.

The validator was saying that the form tag had not been found.

I see that in attempt.php there is the following

/// Start the form
    if($quiz->timelimit > 0) {
        // Make sure javascript is enabled for time limited quizzes
        ?>
        <script language="javascript" type="text/javascript">
        <!--
            document.write("<form name=\"responseform\" id=\"responseform\" method=\"post\" action=\"attempt.php\" autocomplete=\"off\">\n");
        // -->
        </script>
        <noscript>
        <center><p><strong><?php print_string('noscript', 'quiz'); ?></strong></p></center>
        </noscript>
        <?php
    } else {
        echo "<form name=\"responseform\" id=\"responseform\" method=\"post\" action=\"attempt.php\" autocomplete=\"off\">\n";
    }

Which prints the form using javascript if the test is timed, and using php if the test is not timed.

So in a timed quiz there is
 <script language="javascript" type="text/javascript">
        <!--
            document.write("<form name=\"responseform\" id=\"responseform\" method=\"post\" action=\"attempt.php\" autocomplete=\"off\">\n");
        // -->
        </script>
        <noscript>
        <center><p><strong>You need Javascript</strong></p></center>
        </noscript>

And in a timed quiz there is simply
<form name="responseform" id="responseform" method="post" action="attempt.php" autocomplete="off">

AND, if I turn off the time limit in the test, then it works okay in IE9 too.

So instead of putting the <form> tag inside javascript how would it be if i instead

/// Start the form
    if($quiz->timelimit > 0) {
        // Make sure javascript is enabled for time limited quizzes
        ?>
        <script language="javascript" type="text/javascript">
        </script>
        <noscript>
        <center><p><strong><?php print_string('noscript', 'quiz'); ?></strong>
JUMP TO ANOTHER PAGE
</p>
</center>

        </noscript>
        <?php
    } 

       echo "<form name=\"responseform\" id=\"responseform\" method=\"post\" action=\"attempt.php\" autocomplete=\"off\">\n";

I.e. if the form tag were always written by php, but if there is no Javascript then the page is redirected to somewhere else?

Tim

In reply to Timothy Takemoto

Re: Dropdown box not working in Matching Questions

by Timothy Takemoto -

No that did not work.
I just used     
echo "<form name=\"responseform\" id=\"responseform\" method=\"post\" action=\"attempt.php\" autocomplete=\"off\">\n";
irrespective of whether the quiz was timed or not, and still I could not submit in a timed quiz.

Tim

In reply to Timothy Takemoto

Re: Dropdown box not working in Matching Questions

by Timothy Takemoto -

Even worse than my theme, I have hacked attempt.php

I had a load of problems with students sending quizes after they had timed out, especially due to the delay while the responded to the confirm submission screen that appears when one submits a timed test.

I used this

if ($quiz->timelimit == 1) { //takemoto if 1 min submit immediately $onclick = "document.responseform.submit()"; } else { $onclick = "return confirm('$strconfirmattempt')"; }

And maybe
$onclick = "document.responseform.submit()";
Is really awful.

In reply to Timothy Takemoto

Re: Dropdown box not working in Matching Questions

by Timothy Takemoto -

Yes...

I have two moodles. One for content courses and another for English teaching.

I did not implement the above hack on my content course moodle.

On that vanilla moodle drop down boxes do not work in IE9 in secure windows as reported above.

However everything works fine if i move the test to a non-secure window, and keep the "are you sure if you want to submit" warning message.

But with my hack to remove this warning message when quizzes are very short i.e.
if ($quiz->timelimit == 1) { //takemoto if 1 min submit immediately $Xonclick= "document.responseform.submit()"; } else { $Xonclick= "return confirm('$strconfirmattempt')"; } 
which means "just go ahead and submit if this is a 1 minute quiz".

Then it stops working in IE9 unless the compatibility mode button is pressed. I have no idea how I came up with the above code, but it served me very well for about 4  years.

Tim

In reply to Timothy Takemoto

Re: Dropdown box not working in Matching Questions

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Gosh those code snippets you post bring back horrible memories. Yes, there used to be disgusting stuff like document.write in the quiz. I finally got around to fixing all that old mess in Moodle 2.0. I guess that is another reson to plan to upgrade to 2.x sooner rather than later.

In reply to Tim Hunt

Re: Dropdown box not working in Matching Questions

by Timothy Takemoto -

Yes Tim....

I would like to use some of the neat features that you have kindly added to newer versions of the quiz such as question and test feedback and the ability to import category from the GIFT file. And what with older moodles become incompatible with newer browsers, I would like to move to Moodle 2.0 sooner rather than later, but I would need the course date manage to work on moodle 2 before I could move. I have far too many quizes to change their dates by hand one by one.

I think that I will ask someone at guru.com to validate the  code of my attempt.php. If anyone would like to bid (I am hoping for less than $300) please let me know via the email address at my website.

Tim

In reply to Timothy Takemoto

Re: Dropdown box not working in Matching Questions

by Timothy Takemoto -

It seemed that the problem only occurs when the quizes are displayed in a "secure window." This may explain why a Blackboard site was reporting the same problem since they may have been doing the same.

I do not need this type of quiz to be in a secure window, so there is my solution.

In reply to Timothy Takemoto

Re: Dropdown box not working in Matching Questions

by Timothy Takemoto -

Ooops, no, there are still problems as noted above.

In reply to Timothy Takemoto

Re: Dropdown box not working in Matching Questions

by Timothy Takemoto -

I am getting problems now with the same page in Chrome. The submit button does not work.

I think that one of the validation problems of this page is the cause.

E.g. in Chrome a malformed "base" tag can prevent submission.
http://stackoverflow.com/questions/10897360/form-does-not-submit-if-action-present

Tim

In reply to Timothy Takemoto

Re: Dropdown box not working in Matching Questions

by Timothy Takemoto -

I am pretty sure that my problem in Chrome is my hack of the quiz page.  I did not want my  fast vocab quizzes to ask the user if they are sure or not so I added

    if ($quiz->timelimit == 1) {                    //if 1 minute vocab test submit immediately
        $onclick = "document.responseform.submit()";
         } else {
    $onclick = "return confirm('$strconfirmattempt')";
    }

Which produces an input button like this.

<input type="submit" name="finishattempt" value="Submit" onClick="document.form.submit()" />

And alas, Chrome is famous for not liking submit buttons, or being less forgiving....
http://code.google.com/p/chromium/issues/detail?id=11113#c15

And I think I have found a solution which now words in Chrome
Change
        $onclick = "document.responseform.submit()";
To
         $onclick = "document.forms[\'responseform\'].submit()";

Just in case anyone else wants to remove that confirmation. But perhaps one can remove the confirmation via quiz settings in newer versions of Moodle?

Tim

In reply to Timothy Takemoto

Try moodle on any browser

by Timothy Takemoto -

By the way, if anyone has browser compatability problems, then I recommend
https://www.spoon.net/Browsers/
which lets you download and use and try out your moodle on
any browser including IE6 and Safari without installation via  a plugin.

The above fix also fixes the issue in Safari.

Average of ratings: Useful (1)