How can I provide the user with a combo box and based on his selection populate the data in a text box? The data has to come from a back-end database. The catch is that the combo box and the text box are in the same form.
// get selected index
var i = document.formname.comboboxname.selectedIndex;
// get value of selected index
var v = document.formname.comboboxname.options[i].value;
// set value to text box
document.formname.textboxname.value = v;