I have a form with a number of readonly textfields and a button called "modify". On click of the "modify" button, I need to change all the textfields to be editable. Can anyone help me with this one? i currantly have a loop that creates the readonly textfields like this: . . . while($rows = @mysql_fetch_array($result)) { $index++; extract($rows); $desvalue = $rows['description']; $pnovalue = $rows['partno']; echo '<TR><TD><INPUT TYPE="text" READONLY=true NAME="description 1" VALUE="'.$desvalue.'">'; echo '<INPUT TYPE="text" READONLY=true NAME="partno 1" VALUE="'.$pnovalue.'"></TD></TR>'; } PHP:
much easier to create a javascript function in the header section of your page that disables all text fields in the form by refering to the dom object hierarchy. then for the action of the button in the form, refer to the javascript function - using the onClick event...
Thanks daboss. If i understand correctly, do you mean something like this: This is the 'modify' button: <INPUT TYPE=button VALUE="Modify Existing Item" NAME="modifyconfigbutton" ONCLICK=modifyItems();> HTML: THis is the javascript method: function modifyItems() { loadedDesFieldNames = document.getElementById("modifytextfields"); loadedDesFieldNames.attributes.readonly = false; } Code (markup):