Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

replace document.form with document.forms[form], because <form> now u…

…ses an "id" instead of a "name" attribute. (see MDL-8062)
  • Loading branch information...
commit 9f60b599b9184acd6ca462bec5a872addfa3768e 1 parent 1b98048
gbateson authored
Showing with 19 additions and 15 deletions.
  1. +19 −15 mod/hotpot/mod.html
View
34 mod/hotpot/mod.html
@@ -34,25 +34,29 @@
function hotpot_lockoptions(form, master, subitems, offvalues) {
var disabled = false;
- var obj = eval("document."+form+"."+master);
- if (obj) {
- var v = '';
- if (obj.type=='select-one') {
- var v = obj.options[obj.selectedIndex].value;
- for (i=0; i<offvalues.length; i++) {
- if (v==offvalues[i]) {
+ var Frm = document.forms[form]; // document.getElementById(form);
+ if (Frm) {
+ var obj = Frm.elements[master];
+ if (obj) {
+ var v = '';
+ if (obj.type=='select-one') {
+ var v = obj.options[obj.selectedIndex].value;
+ for (i=0; i<offvalues.length; i++) {
+ if (v==offvalues[i]) {
+ disabled = true;
+ }
+ }
+ } else if (obj.type=='checkbox') {
+ if (obj.checked==false) {
disabled = true;
}
}
- } else if (obj.type=='checkbox') {
- if (obj.checked==false) {
- disabled = true;
- }
}
- }
- if (document.getElementById) {
for (i=0; i<subitems.length; i++) {
- eval("document."+form+"."+subitems[i]+".disabled="+disabled);
+ var obj = Frm.elements[subitems[i]];
+ if (obj) {
+ obj.disabled = disabled;
+ }
}
}
return(true);
@@ -371,7 +375,7 @@
// override the standard Moodle "setfocus" function,
// which gives a js error if the "name" field is hidden
function setfocus() {
- var f = getElementById('form');
+ var f = document.getElementById('form');
if (f) {
if (canfocus(f, 'namesource')) {
f.namesource.focus();
Please sign in to comment.
Something went wrong with that request. Please try again.