Goldilocks
02-25-2004, 08:46 AM
What am I doing wrong here? The following code is meant to disable the textbox called txtNewIssue if the user selects a certain option from a dropdown box called DocStatusID. If they select any other option from the dropdown then the textbox should be enabled again.
The code I have so far seems to disable the box no matter what option I choose and then won't enable it again. I have checked the value that is being passed from the dropdown and it is correct. It is going to the correct part of the function depending on this, yet it still disables the textbox anyway. I am using IE6 if that helps.
<script language="javascript">
function ROstatus() {
alert(document.form1.DocStatusID.value);
//Document is rejected
if (document.form1.DocStatusID.value==2) {
alert("rejected")
document.form1.txtNewIssue.disabled='true';
return true;
}
//Document id Approved
else
{
alert("approved");
document.form1.txtNewIssue.disabled='false';
return true;
}
}
</script>
The code I have so far seems to disable the box no matter what option I choose and then won't enable it again. I have checked the value that is being passed from the dropdown and it is correct. It is going to the correct part of the function depending on this, yet it still disables the textbox anyway. I am using IE6 if that helps.
<script language="javascript">
function ROstatus() {
alert(document.form1.DocStatusID.value);
//Document is rejected
if (document.form1.DocStatusID.value==2) {
alert("rejected")
document.form1.txtNewIssue.disabled='true';
return true;
}
//Document id Approved
else
{
alert("approved");
document.form1.txtNewIssue.disabled='false';
return true;
}
}
</script>