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!

filling text box from select entry

Status
Not open for further replies.

spruce009

MIS
May 12, 2003
33
US
I have a form with a select box filled with company names. When the company name is selected, I want the form text boxes for the address, city state, zip, phone to be automatically filled based on the select list index. I am trying to figure this out, and get errors. I am new to Javascript, can someone point me in the right direction? The form is an ASP page. Thanks.
 
<script language="JavaScript">
function ChangeAddress(objElement){
var RecValue = objElement.value;
alert ("The Value is " + RecValue);
}

</script>
<select style="width:170; font-size:10;" name="RecName" class="textfield" onchange="ChangeAddress(this);">
<option value=0>STORIS, Inc.
<option value=1>STORIS, Inc. (FLA)
</select>
 
<select> elements are a little different...use this:

function ChangeAddress(objElement){
var RecValue = objElement.options[objElement.selectedIndex].value;
alert ("The Value is " + RecValue);
}

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top