Skip to content

Commit

Permalink
MDL-14439 IE and Opera fire the onchange when ever you move into a dr…
Browse files Browse the repository at this point in the history
…opdwown list with the keyboard - this changes fix the problem. Merged from 19.
  • Loading branch information
jerome committed May 2, 2008
1 parent 5ddb20a commit 52cc2b7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/javascript.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php /// $Id$

/// Load up any required Javascript libraries

if (!defined('MOODLE_INTERNAL')) {
Expand All @@ -24,6 +25,7 @@
<script type="text/javascript" src="<?php echo $CFG->httpswwwroot ?>/lib/overlib/overlib_cssstyle.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">

Expand Down
13 changes: 11 additions & 2 deletions lib/weblib.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php // $Id$


///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
Expand Down Expand Up @@ -1110,8 +1111,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";
}
Expand Down

0 comments on commit 52cc2b7

Please sign in to comment.