Selecting list item to auto-populate text fields

D

Dave

Hi folks,

I'm in the middle of adding some validation functionality to an inventory
tracking form.

What I would like to do is have one dropdown menu/Listbox(Part Number) and
another text field (Product Description).

When the user selects an item from the drop down (IE 12S0FB) it will
autopopulate the text field with a description of the product. At the
moment I will hard code the values in. Can anyone help me out here?

Thanks,
Dave
 
R

Roy Schestowitz

Dave said:
Hi folks,

I'm in the middle of adding some validation functionality to an inventory
tracking form.

What I would like to do is have one dropdown menu/Listbox(Part Number) and
another text field (Product Description).

When the user selects an item from the drop down (IE 12S0FB) it will
autopopulate the text field with a description of the product. At the
moment I will hard code the values in. Can anyone help me out here?

Thanks,
Dave

You can do this using JavaScript. For example:

<html>
<head>
<script type="text/javascript">
function addText(myform){
// get the ID of the text box
// use document.myform.options[document.myform.myitem.selectedIndex].value
// to resolve text to insert
}
</script>
</head>


<body>
<form name="myform">
<select name="myitem" onChange="javascript:addText()">
<option value="item1">Item #1</option>
<option value="item2">Item #2</option>
</select>
</form>
</body>
</html>

Don't try it as it's not tested. It's the idea that counts.

Roy

PS - Please don't make corrections, guys. It's just a rough example...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top