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!

Populate Input box with result from Selection

Status
Not open for further replies.

jon24422531

Technical User
Jan 27, 2004
295
GB
Guys

Not sure if this is a bit of a newbie question, but here goes:

I have a form in which users (it's an internal web site) report on our customers. This form has a selection drop down box that I have populated with our unique CustomerID. What I would like is for another Text Box to be populated with that customers Name depending on which CustomerID is selected. The SQL part is OK, and I can return all the data, but I am not sure how to dynamically update one field with the results of another.

Any help would be much appreciated.

Jonathan
 


<script type="text/javascript">

function changeme(me)

{
var doItToME;
var model;
var amtx;
doItToMe = window.document.getElementById("amt");
model = me.value;

if (model == "T30")
{
amtx = "400.00";
}


amtz = parseInt(amtx);
amtx = amtz

if (amtz > 0)
{
amtz = amtz+ 25;
amtx = "$" + amtz + ".00";
}

doItToMe.value = amtx;



}

</script>
.
.
. this format is based on a pull-down (select) that selects a model.
. another box (amt) is filled with the value based on the select
. the example above will fill $400.00 in the amt box if the selected model is T30.
.
.

<SELECT NAME="modl" id="modl" SIZE="1" onchange="return changeme(this)">
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top