diff --git a/lib/scripts/script.js b/lib/scripts/script.js index c79c9b683a4fd1ea5419836d756e6d03e00c57e3..b9b324f96f5d98a229015137b99ad24c01f06c09 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -460,19 +460,29 @@ addInitEvent(function(){ }); /** - * Add the event handler to the actiondropdown + * Autosubmit quick select forms + * + * When a <select> tag has the class "quickselect", this script will + * automatically submit its parent form when the select value changes. + * It also hides the submit button of the form. * * @author Andreas Gohr <andi@splitbrain.org> */ addInitEvent(function(){ - var selector = $('action__selector'); - if(!selector) return; - - addEvent(selector,'change',function(e){ - this.form.submit(); - }); - - $('action__selectorbtn').style.display = 'none'; + var selects = getElementsByClass('quickselect',document,'select'); + for(var i=0; i<selects.length; i++){ + // auto submit on change + addEvent(selects[i],'change',function(e){ + this.form.submit(); + }); + // hide submit buttons + var btns = selects[i].form.getElementsByTagName('input'); + for(var j=0; j<btns.length; j++){ + if(btns[j].type == 'submit'){ + btns[j].style.display = 'none'; + } + } + } }); /**