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!

how do I create a dynamically linked listbox

Status
Not open for further replies.

epiphany

Programmer
Dec 16, 1999
1
US
I am using visual interdev to create an asp page. I have a populated drop down list and would like to display the result of a user selection in another text area. In other words, when a user makes a selection from the drop down list, I would like to show the result(s) of that selection in a text area box. Can you help me with the code?
 
Here's a small page that does exactly what you want to do. Load this on your server, run it and let me know if you have any questions.

Basically your drop down list has two parameters. The value, which you want to populate with the text that you want displayed in the textarea. And the text, which is what is actually displayed in the list.

The one line function does the rest for you.


<html>
<head>
<script Language=&quot;JavaScript&quot;>
<!--
function moveData(form_ref) {
form_ref.results.value = form_ref.mylist.options[form_ref.mylist.selectedIndex].value
}

//-->
</script>
</head>
<body>
<form>
<select name=&quot;mylist&quot; onChange=&quot;moveData(this.form);&quot;>
<option value=&quot;&quot;>Select a Name</option>
<option value=&quot;My name is Epiphany. I am 25 years old and currently I am trying to find a solution to this particular problem.&quot;>Ephiphany</option>
<option value=&quot;My name is Todd. I am 31 years old and currently I am helping a friend with a web design solution.&quot;>Todd WW</option>
</select><br><br>
<textarea name=&quot;results&quot; cols=&quot;30&quot; rows=&quot;5&quot;></textarea>

</form>
</body>
</html>


Happy Listing :)

ToddWW
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top