moodle/user/user.js

29 lines
781 B
JavaScript
Raw Normal View History

function checksubmit(form) {
var destination = form.formaction.options[form.formaction.selectedIndex].value;
if (destination == "" || !checkchecked(form)) {
form.formaction.selectedIndex = 0;
return false;
} else {
return true;
}
}
function checkchecked(form) {
2009-07-02 04:03:04 +00:00
var inputs = document.getElementsByTagName('INPUT');
var checked = false;
inputs = filterByParent(inputs, function() {return form;});
for(var i = 0; i < inputs.length; ++i) {
2009-07-02 04:03:04 +00:00
if (inputs[i].type == 'checkbox' && inputs[i].checked) {
checked = true;
}
}
return checked;
}
function conditionalsubmit(event, args) {
var form = document.getElementById(args.formid);
if (checksubmit(form)) {
form.submit();
}
}