summaryrefslogtreecommitdiff
path: root/lib/scripts/script.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/scripts/script.js')
-rw-r--r--lib/scripts/script.js28
1 files changed, 19 insertions, 9 deletions
diff --git a/lib/scripts/script.js b/lib/scripts/script.js
index c79c9b683..b9b324f96 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';
+ }
+ }
+ }
});
/**