Permalink
Browse files

MDL-14439 IE and Opera fire the onchange when ever you move into a dr…

…opdwown list with the keyboard - this changes fix the problem. Merged from 19.
  • Loading branch information...
1 parent 0345ccd commit 7987cbb64c0dee67a6c6d746b127813156049cca jerome committed May 2, 2008
Showing with 11 additions and 2 deletions.
  1. +1 −0 lib/javascript.php
  2. +10 −2 lib/weblib.php
View
@@ -23,6 +23,7 @@
<script type="text/javascript" src="<?php echo $CFG->httpswwwroot ?>/lib/overlib.js"></script>
<script type="text/javascript" src="<?php echo $CFG->httpswwwroot ?>/lib/cookies.js"></script>
<script type="text/javascript" src="<?php echo $CFG->httpswwwroot ?>/lib/ufo.js"></script>
+<script type="text/javascript" src="<?php echo $CFG->httpswwwroot ?>/lib/dropdown.js"></script>
<script type="text/javascript" defer="defer">
View
@@ -963,8 +963,16 @@ function popup_form($common, $options, $formid, $selected='', $nothing='choose',
$selectlabel = '<label for="'.$formid.'_jump">'.$selectlabel.'</label>';
}
- $output .= '<div>'.$selectlabel.$button.'<select id="'.$formid.'_jump" name="jump" onchange="'.$targetwindow.'.location=document.getElementById(\''.$formid.'\').jump.options[document.getElementById(\''.$formid.'\').jump.selectedIndex].value;">'."\n";
-
+ //IE and Opera fire the onchange when ever you move into a dropdwown list with the keyboard.
+ //onfocus will call a function inside dropdown.js. It fixes this IE/Opera behavior.
+ if (check_browser_version('MSIE') || check_browser_version('Opera')) {
+ $output .= '<div>'.$selectlabel.$button.'<select id="'.$formid.'_jump" onfocus="initSelect(\''.$formid.'\','.$targetwindow.')" name="jump">'."\n";
+ }
+ //Other browser
+ else {
+ $output .= '<div>'.$selectlabel.$button.'<select id="'.$formid.'_jump" name="jump" onchange="'.$targetwindow.'.location=document.getElementById(\''.$formid.'\').jump.options[document.getElementById(\''.$formid.'\').jump.selectedIndex].value;">'."\n";
+ }
+
if ($nothing != '') {
$output .= " <option value=\"javascript:void(0)\">$nothing</option>\n";
}

0 comments on commit 7987cbb

Please sign in to comment.