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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Question

Status
Not open for further replies.

Mighty

Programmer
Feb 22, 2001
1,682
US
Hi,

I have a page that reads two columns from a database ( part number and part description ). It then displays a form with the part numbers in a list box and an empty text box beside it. What I would like to be able to do is automatically polulate the text box with the part description once the user selects a part number from the list. Can someone please advise me on how to do this.
 
- you should have posted your question on the javascript forum where it would have been more appropriate ..
- now the jscript answer :
1 - to fire the function :
<select name=&quot;myselect&quot; onchange=&quot;populate()'>
....
2 - to associate number & description : when you build your select list do :
<option value=DESCRIPTION_VALUE>NUMBER_VALUE</option>
i don't now which language you're using to dynamically fill it in but you get the idea here
3 - the listbox should be named : (as well as the form itself)
<input type=text id=mytextbox ...>
4 - so now the function is :
function populate() {
document.formname.mytextbox.value=document.formname.myselect.options[document.formname.myselect.slectedIndex].value;
}

-----------------
this is ie 4+ only !!!!!! maybe ns6+ ....
-----------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top