chrismassey
Programmer
Hello,
I have a javascript which disables a textbox when the page loads. However, it disables every elements of the textbox including its value. I just want to stop the user being able to input or change text within, and just to view the text that is in there already. When they click a submit button, I use the value from the textbox, but if its disabled then the value cannot be used...
(Javescript in <head>)
(form in <body>)
Thank you for all your help
I have a javascript which disables a textbox when the page loads. However, it disables every elements of the textbox including its value. I just want to stop the user being able to input or change text within, and just to view the text that is in there already. When they click a submit button, I use the value from the textbox, but if its disabled then the value cannot be used...
(Javescript in <head>)
Code:
<script language="javascript">
function enableField()
{
document.form1.OpenText1.disabled=false;
document.form1.OpenText2.disabled=false;
}
</script>
<script language="javascript">
function disableField()
{
document.form1.OpenText1.disabled=true;
document.form1.OpenText2.disabled=true;
}
</script>
(form in <body>)
Code:
<FORM ACTION="script.pl" METHOD=POST NAME="form1">
<p><input type="submit" value="+ Directory" name="create_directoryb" target="_blank"> <input type="submit" value="+ Page" name="create_pageb" target="_blank"> <input type="submit" value="- Direc/Page" name="delete_direc_pageb" target="_blank"> <input type="submit" value="Rename Direc/Page" name="rename_direc_pageb" target="_blank"></p>
<p><font size="2" face="Arial">Path input: </font><font size="2" face="Arial">| </font><a href="javascript:enableField()"><font size="2" face="Arial">Enabled</font></a><font size="2" face="Arial">
</font><a href="javascript:enableField()"><a/></a><font size="2" face="Arial">|</font> <a href="javascript:disableField()"><font size="2" face="Arial">Disabled</font></a><font size="2" face="Arial">
|</font><a href="javascript:disableField()"><a/></p>
<p><input type="text" name="OpenText1" size="50" value="z" disabled="false"><input type="submit" value="Open" name="openb1"></p>
<p><input type="text" name="OpenText2" size="50" disabled="false"><input type="submit" value="Open" name="openb2"></p>
</FORM>
Thank you for all your help