Click to See Complete Forum and Search --> : Populate text box using combo


slyndon
06-07-2003, 04:36 PM
Hi there

I have a HTML form which consists of 1 combo, 1 text box and a submit button.

I am already sucessfully using ASP to populate the combo with the contents of a table from my database.

When I select an option from the combo I want the combo value to populate the text box. If I then change the selected option in the combo, the text box changes accordingly.

I can then make changes to the value in the text box and submit the form - using ASP to update the record.

If anyone can point me in the right direction I'd be grateful.

Regards
Scott

Khalid Ali
06-07-2003, 04:51 PM
Try this link..it does exactly what you mentioned.

http://68.145.35.86/skills/javascripts/DropDownShowSelectionInTextField.html

slyndon
06-08-2003, 06:03 AM
Originally posted by Khalid Ali
Try this link..it does exactly what you mentioned.

http://68.145.35.86/skills/javascri...nTextField.html


That URL is returning a 'Cannot Find Server' ..

Dave Clark - I am giving your suggestion a go.

slyndon
06-08-2003, 07:21 AM
Dave - couldn't get your code to work, but have come up with this:

<script language="JavaScript">
<!--
function update_textbox()
{
document.editunit.Unit.value = document.editunit.UnitList.value;
}
//-->
</script>

The only problem I am having with this is that it is populating my text box with the VALUE of the selected combo item. I need it to populate the text box with the TEXT of the selected item. I have tried replacing the document.editunit.UnitList.value with document.editunit.UnitList.text but it doesn't work. Anyone know how to pull the TEXT instead of the value???

Ta.
Scott

slyndon
06-08-2003, 12:23 PM
Cheers - sorted now.