Forum Moderators: open
Is there another way to make fields disabled or readonly?
This is relatively straight forward. If you wrap your form in a layer with an ID of (say) formHolder, you can use the getElementsByTagName to change all elements of a certain tag:
function disableInputs() {theInputs = new Array();
theInputs = document.getElementById('formHolder').getElementsByTagName('input');
for (i=0; i<theInputs.length; i++) {
theInputs[i].disabled=true;
}
}
One thing to remember is to put your Reset and Submit input buttons outside the div so that they are not affected by the script. You can also apply this to select lists and textareas.
HTH