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

getting value from drop down list and put into text box

Status
Not open for further replies.

allyeric

Programmer
Mar 14, 2000
104
CA
on my page, I have a drop down list, with quite a few choices for the user, and a text box.&nbsp;&nbsp;Once the user clicks on a choice, I would like that text to be put into the text box.&nbsp;&nbsp;Any help greatly appreciated!<br><br>thanks
 
This is a javascript question not an asp question so you should go to a javascript forum. But I'll outline one possible way to do this anyways. In the select tag of the HTML page you need to put an onChange statement which calls a javascript function:<br><br>&lt;select name=thelist onChange=&quot;putValueInBox();&quot;&gt;<br><br>Then the javascript function needs to get the value of the selection list and put it in the text area:<br><br>function putValueInBox()<br>{var listvalue = document.thenameofyourform.thelist.value;<br>document.thenameofyourform.thenameofyourtextarea.value += listvalue;}<br><br>Something like this should work. Note a script like the one above might not work in some Netscape browsers because the selection list doesn't automatically inherit it's selected option value which means you might have to write something like:<br><br>document.theform.thelist.options[document.theform.thelist.selectedIndex].value<br><br>I do pretty complicated movement of values around form elements all the time for site management tools so if you can't figure it out from this email me your script and I can take a look at it.<br><br><A HREF="mailto:wduty@radicalfringe.com">wduty@radicalfringe.com</A>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top