MDL-20204 new single_select + cleanup

This commit is contained in:
Petr Skoda
2010-02-09 17:39:13 +00:00
parent 695a6fb80a
commit a9967cf5a5
4 changed files with 208 additions and 119 deletions

View File

@@ -381,6 +381,19 @@ M.util.init_maximised_embed = function(Y, id) {
};
};
/**
* Attach handler to single_select
*/
M.util.init_single_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) {
Y.one('#'+formid).submit();
}
},
'#'+selectid);
});
};
//=== old legacy JS code, hopefully to be replaced soon by M.xx.yy and YUI3 code ===