Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi, I was wondering if anyone co

Status
Not open for further replies.

Kevin123456

Technical User
Jan 14, 2002
35
0
0
GB
Hi,

I was wondering if anyone could answer a question. I'm trying to design a form that has a few fields in it. One of the fields is a combo box with only two options in it. On selecting one option I'd like to auto fill another field and prevent the user from changing the contents of the field. I've read faq215-135 regarding the onfocus method and it doesn't seem to be dynamic as ideally when the user chooses the other option from the combo box they can either enter a number or be able to click on a link that allows them to select the number and then fills that back into the field.

Any help would be gratefully appreciated.

Thanks
 
for ie6 and ns6.2, you can change the readonly property for the given text box using javascript. for example...
Code:
function updateText(strNewText)
{
  document.getElementById("txt1").value = strNewText;
  document.getElementById("txt1").readOnly = true;
}
where...
Code:
<input type=&quot;text&quot; id=&quot;txt1&quot; value=&quot;&quot;>

for older browsers, the above code will not work, but there are probably variations that will.

glenn
 
Thanks for the code, unfortunately it's being deployed on an intranet where the browser is IE 5 - just to be difficult
 
i don't have a copy of ie5 for testing, nor do i have any documentation on the features it supports, but if ie5 supports the readOnly property, then you should be able to change the above function a little and have it work.

try replacing the
Code:
document.getElementById(&quot;txt1&quot;)
with
Code:
document.all.txt1
.

glenn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top