mirror of
https://github.com/moodle/moodle.git
synced 2025-07-14 02:46:30 +02:00
New useful function submitFormById(). Fires off the form's onsubmit() handler first,
if applicable, and only submits if the handler doesn't exist or returns true.
This commit is contained in:
@ -56,3 +56,16 @@ function unlockoption(form,item) {
|
||||
eval("document."+form+"."+item+".disabled=false");/* IE thing */
|
||||
eval("document."+form+".h"+item+".value=0");
|
||||
}
|
||||
|
||||
function submitFormById(id) {
|
||||
var theform = document.getElementById(id);
|
||||
if(!theform) {
|
||||
return false;
|
||||
}
|
||||
if(theform.tagName != 'FORM') {
|
||||
return false;
|
||||
}
|
||||
if(!theform.onsubmit || theform.onsubmit()) {
|
||||
return theform.submit();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user