I had to write a “simple” javascript iterating through all the existing form elements, check if its a text input, and enable/disable it based on action. Googled “javascript iterate form element“, pulled out this piece of code and it works fabulously on Firefox. Great, simple 5 min job.
var e = document.getElementById("my-form").elements;
for(i in e) {
if((e[i].type == ‘text’) && (e[i].name.indexOf(’stock’) > 0))
…do something…
}
Next day, checked again in Internet Explorer and the script failed to execute with “type is null or not an object” error. Thereafter, went into full 6 hours of googling until I stumbled upon the differences of form iteration between IE and Firefox. To have it working in both, you probably want to iterate using elements length
for (var i=0; i < e.length; i++) {
if((e[i].type == ‘text’) && (e[i].name.indexOf(’stock’) > 0))
… do something…
}
Still can’t believe I spent 6 precious weekend hours on this problem.

