Permalink
Browse files

see MDL-8886.

fixes bug that meant :

       $mform->disabledIf('studentfeedbackurl', 'studentfeedback', 'eq', 0);
       $mform->disabledIf('studentfeedbackurl', 'studentfeedback', 'eq', 3);
       $mform->disabledIf('studentfeedbackurl', 'studentfeedback', 'eq', 4);

didn't work.
  • Loading branch information...
jamiesensei
jamiesensei committed Apr 6, 2007
1 parent f16220e commit 326d894b833f95b709fa6c0ade36dc874c7a11a4
Showing with 12 additions and 2 deletions.
  1. +12 −2 lib/javascript-static.js
View
@@ -86,6 +86,7 @@ function unlockoption(form,item) {
function lockoptionsall(formid) {
var form = document.forms[formid];
var dependons = eval(formid+'items');
+ var tolock = Array();
for (var dependon in dependons) {
var master = form[dependon];
for (var condition in dependons[dependon]) {
@@ -104,12 +105,21 @@ function lockoptionsall(formid) {
lock = master.value!=value; break;
}
for (var ei in dependons[dependon][condition][value]) {
- var formelement = form[dependons[dependon][condition][value][ei]];
- formelement.disabled = lock;
+ var eltolock = dependons[dependon][condition][value][ei];
+ if (tolock[eltolock] != null){
+ tolock[eltolock] =
+ lock || tolock[eltolock];
+ } else {
+ tolock[eltolock] = lock;
+ }
}
}
}
}
+ for (var el in tolock){
+ var formelement = form[el];
+ formelement.disabled = tolock[el];
+ }
return true;
}

0 comments on commit 326d894

Please sign in to comment.