Permalink
Browse files

merged in fix for MDL-10382 and MDL-10440 from HEAD. Revision 1.36 -1…

….38 from HEAD
  • Loading branch information...
1 parent 5097b72 commit 2da97a4f23e51c266d44bace793b46834b8262a8 jamiesensei committed Jul 13, 2007
Showing with 34 additions and 23 deletions.
  1. +34 −23 lib/javascript-static.js
View
@@ -89,6 +89,9 @@ function lockoptionsall(formid) {
var tolock = Array();
for (var dependon in dependons) {
var master = form[dependon];
+ if (master == undefined) {
+ continue;
+ }
for (var condition in dependons[dependon]) {
for (var value in dependons[dependon][condition]) {
var lock;
@@ -118,6 +121,9 @@ function lockoptionsall(formid) {
}
for (var el in tolock){
var formelement = form[el];
+ if (formelement == undefined) {
+ continue;
+ }
formelement.disabled = tolock[el];
}
return true;
@@ -128,16 +134,21 @@ function lockoptionsallsetup(formid) {
var dependons = eval(formid+'items');
for (var dependon in dependons) {
var master = form[dependon];
- master.onclick = function() {return lockoptionsall(this.form.getAttribute('id'));};
- master.onblur = function() {return lockoptionsall(this.form.getAttribute('id'));};
- master.onchange = function() {return lockoptionsall(this.form.getAttribute('id'));};
+ if (master == undefined) {
+ continue;
+ }
+ master.formid = formid;
+ master.onclick = function() {return lockoptionsall(this.formid);};
+ master.onblur = function() {return lockoptionsall(this.formid);};
+ master.onchange = function() {return lockoptionsall(this.formid);};
}
for (var i = 0; i < form.elements.length; i++){
var formelement = form.elements[i];
if (formelement.type=='reset') {
- formelement.onclick = function() {this.form.reset();return lockoptionsall(this.form.getAttribute('id'));};
- formelement.onblur = function() {this.form.reset();return lockoptionsall(this.form.getAttribute('id'));};
- formelement.onchange = function() {this.form.reset();return lockoptionsall(this.form.getAttribute('id'));};
+ formelement.formid = formid;
+ formelement.onclick = function() {this.form.reset();return lockoptionsall(this.formid);};
+ formelement.onblur = function() {this.form.reset();return lockoptionsall(this.formid);};
+ formelement.onchange = function() {this.form.reset();return lockoptionsall(this.formid);};
}
}
return lockoptionsall(formid);
@@ -399,22 +410,22 @@ function fix_column_width(colName) {
/*
- Insert myValue at current cursor position
-*/
+ Insert myValue at current cursor position
+ */
function insertAtCursor(myField, myValue) {
- // IE support
- if (document.selection) {
- myField.focus();
- sel = document.selection.createRange();
- sel.text = myValue;
- }
- // Mozilla/Netscape support
- else if (myField.selectionStart || myField.selectionStart == '0') {
- var startPos = myField.selectionStart;
- var endPos = myField.selectionEnd;
- myField.value = myField.value.substring(0, startPos)
- + myValue + myField.value.substring(endPos, myField.value.length);
- } else {
- myField.value += myValue;
- }
+ // IE support
+ if (document.selection) {
+ myField.focus();
+ sel = document.selection.createRange();
+ sel.text = myValue;
+ }
+ // Mozilla/Netscape support
+ else if (myField.selectionStart || myField.selectionStart == '0') {
+ var startPos = myField.selectionStart;
+ var endPos = myField.selectionEnd;
+ myField.value = myField.value.substring(0, startPos)
+ + myValue + myField.value.substring(endPos, myField.value.length);
+ } else {
+ myField.value += myValue;
+ }
}

0 comments on commit 2da97a4

Please sign in to comment.