Issue Details (XML | Word | Printable)

Key: MDL-18735
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Tim Hunt
Reporter: Artem Andreev
Votes: 1
Watchers: 4
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

disabledif doesn't work in IE 7

Created: 29/Mar/09 06:01 AM   Updated: 07/May/09 02:56 AM
Return to search
Component/s: Forms Library
Affects Version/s: 1.9.4
Fix Version/s: 1.9.5

Environment: Moodle 1.9.4+ (Build: 20090325)
Issue Links:
Duplicate
 

Participants: Artem Andreev, Nicolas Connault, Petr Skoda, Ryan Smith, Sehrish Abdul Malik and Tim Hunt
Security Level: None
QA Assignee: Nicolas Connault
Difficulty: Easy
Resolved date: 06/Apr/09
Affected Branches: MOODLE_19_STABLE
Fixed Branches: MOODLE_19_STABLE


 Description  « Hide
Steps to reproduce:
1. Run IE 7.
2. Add grade item on Edit categories and items page.
3. Select for Grade type option "Scale"
Field "Scale" doesn't enable. Fields "Maximum grade" and "Minimum grades" doesn't disable.

Revert javascript-static.js to previous version helps. Seems as regression from MDL-18522.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Tim Hunt added a comment - 02/Apr/09 10:04 AM
The fix for MDL-15827 is the other possible cause for this regression.

I'm going to leave this for a day or too in case a GSOC applicant wants to fix it, otherwise I will have to try to fix it myself before the next weekly.


Sehrish Abdul Malik added a comment - 03/Apr/09 07:08 PM
I was tracking down the bug and found its is reproducible in IE7,
working fine on firefox 3.0.8
but not working on Opera 9.6.3.
when we choose Edit categories and item page from action dropdown menu the respective pages doesn't show up in case of Opera.

Howeven for IE7, i have found:

1. /moodle/grade/edit/tree/item.php uses $mform object of type edit_item_form and calls its display method.
2. edit_item_form generates all the html code and hooks different javascript methods.
3. lockoptionsall() method in /moodle/lib/javascript-static.js actually enable disable all fields assosiated with form and in case of firefox it is working and but not in IE7's case.
4. seems like there is some bug in IE7, I googled it and found this link http://11heavens.com/IE7-bug-report-onclick-event-handler.

For the time being i am still working on the bug and trying to find out a descent fix. But i would appreciate if i could get some hints on this


Sehrish Abdul Malik added a comment - 03/Apr/09 08:03 PM
After my investigation over the bug it seems to be a bug in microsoft IE7. The browser is not currently supporting the onclick, onblur, onchange handlers on the DOM option elements. As a proof of concept here is an html code to test on both IE7 and FF1+:

<html>
<head>

<script>
window.onload = function(){
document.getElementById('optA').onclick = function() {alert('Event handler hook called...')};
}
</script>

</head>
<body>
<select id="selBox" name="bakwas">
<option id="optA" value="1">Option A</option>
<option id="optB" value="2">Option B</option>
</select>
</body>
</html>

The code gave me no alert when I clicked option A in IE7 but that alert appeared when I did the same action in Firefox. Check it out!


Sehrish Abdul Malik added a comment - 03/Apr/09 08:05 PM
correct me if i am wrong this bug cannot be fixed without major changes in the code.

Tim Hunt added a comment - 03/Apr/09 09:23 PM
Yes, but we need to fix it. Does it work if we switch to using the YUI events library to add the even handlers?

Ryan Smith added a comment - 03/Apr/09 09:29 PM
Just an FYI from MDL-18779.... this bug occurs in IE6, IE7, and IE8.

Sehrish Abdul Malik added a comment - 03/Apr/09 10:07 PM
I hooked an option tag with YUI event utilities and tested the same code i pasted earlier .... its once again working on firefox but not on IE7

Tim Hunt added a comment - 06/Apr/09 10:54 AM
Note that this works in most cases. For example all the enable disable on the quiz settings page works.

So, as Sehrish found, the problem seems to be when the source element is a Dropdown menu, the event handler does not fire.

OK. The problem is that in Internet Exporer, if select is a HTML select element, then select[0] is the first option element inside it. So my test for whether form[dependon] was a single element, or array of elements (radio buttons), was broken.

I was doing if (!masters[0]). Now I will try if (masters.tagName)

Doh! I was already using the .tagName test everywhere else.

OK, fix checked in.


Petr Skoda added a comment - 06/Apr/09 03:17 PM
yay!
thanks

Nicolas Connault added a comment - 14/Apr/09 03:46 PM
Tested: works fine! Thanks.