Skip to content
Snippets Groups Projects
Commit ceea734a authored by Andreas Gohr's avatar Andreas Gohr
Browse files

Made the auto submit script more versatile

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.
parent 06756ad2
No related branches found
No related tags found
No related merge requests found
......@@ -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';
}
}
}
});
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment