diff --git a/lib/javascript-static.js b/lib/javascript-static.js index ff776f8262d..d7123858e75 100644 --- a/lib/javascript-static.js +++ b/lib/javascript-static.js @@ -333,13 +333,37 @@ M.util.init_maximised_embed = function(Y, id) { * Attach handler to single_select */ M.util.init_select_autosubmit = function(Y, formid, selectid, nothing) { - YUI(M.yui.loader).use('node', function(Y) { - Y.on('change', function() { - if ((nothing == false && Y.Lang.isBoolean(nothing)) || Y.one('#'+selectid).get('value') != nothing) { - Y.one('#'+formid).submit(); + Y.use('event-key', function() { + var select = Y.one('#'+selectid); + if (select) { + // Try to get the form by id + var form = Y.one('#'+formid) || (function(){ + // Hmmm the form's id may have been overriden by an internal input + // with the name id which will KILL IE. + // We need to manually iterate at this point because if the case + // above is true YUI's ancestor method will also kill IE! + var form = select; + while (form && form.get('nodeName').toUpperCase() !== 'FORM') { + form = form.ancestor(); + } + return form; + })(); + // Make sure we have the form + if (form) { + // Create a function to handle our change event + var processchange = function(e, lastindex) { + if ((nothing===false || select.get('value') != nothing) && lastindex != select.get('selectedIndex')) { + this.submit(); + } + } + // Attach the change event to the keypress, blur, and click actions. + // We don't use the change event because IE fires it on every arrow up/down + // event.... usability + Y.on('key', processchange, select, 'press:13', form, select.get('selectedIndex')); + select.on('blur', processchange, form, select.get('selectedIndex')); + select.on('click', processchange, form, select.get('selectedIndex')); + } } - }, - '#'+selectid); }); }; @@ -349,9 +373,9 @@ M.util.init_select_autosubmit = function(Y, formid, selectid, nothing) { M.util.init_url_select = function(Y, formid, selectid, nothing) { YUI(M.yui.loader).use('node', function(Y) { Y.on('change', function() { - if ((nothing == false && Y.Lang.isBoolean(nothing)) || Y.one('#'+selectid).get('value') != nothing) { - window.location = M.cfg.wwwroot+Y.one('#'+selectid).get('value'); - } + if ((nothing == false && Y.Lang.isBoolean(nothing)) || Y.one('#'+selectid).get('value') != nothing) { + window.location = M.cfg.wwwroot+Y.one('#'+selectid).get('value'); + } }, '#'+selectid); }); diff --git a/theme/base/style/core.css b/theme/base/style/core.css index fa3212d9b07..dc193f44dd2 100644 --- a/theme/base/style/core.css +++ b/theme/base/style/core.css @@ -248,7 +248,7 @@ a.skip:active {position: static;display: block;} .groupmanagementtable #removeselect_wrapper label, .groupmanagementtable #addselect_wrapper label {font-weight: normal;} #group-usersummary {width: 14em;} -div.groupselector {float: left;margin-top: 3px;margin-bottom: 3px;} +.groupselector {margin-top: 3px;margin-bottom: 3px;} /** * Login