I have a script that will loop through all the INPUT elements of a form; if the input is a submit it will disable the submit (or enable the submit, depending upon what is passed to the function.)
I hate using eval() - I avoid it whenever I can! Is there a better way to dynamically process the ".disabled = 'true'/'false';" portion?
Code:
// a function that will (dis/en)able all submit buttons
function edSubmit(thisStatus) { // thisStatus is either "true" or "false"
var elementArray = new Array();
elementArray = document.bft.getElementsByTagName("input");
thisVar = ""; arrayLength = elementArray.length;
for(i=0;i<arrayLength;i++) {
if(/submit/i.test(elementArray[i].type)) {
eval("document.bft."+elementArray[i].name+".disabled = " + thisStatus + ";");
}
}
}
I think I'm going to be stuck with using eval() for this. I've tried many different bracketed syntax formulas, and they all will disable the submit, but (for whatever reason) will not enable the submit upon either successful response or timeout due to lack of response.
As much as I hate eval(), it seems to be the only option (at least, for now.)
Thanks to everyone who offered suggestions/ideas. Much appreciated.
Bookmarks