Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Selecting list item to auto-populate text fields

Reply
Thread Tools

Selecting list item to auto-populate text fields

 
 
Dave
Guest
Posts: n/a
 
      01-25-2005
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


 
Reply With Quote
 
 
 
 
Roy Schestowitz
Guest
Posts: n/a
 
      01-25-2005
Dave wrote:

> 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...

--
Roy Schestowitz
http://schestowitz.com
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Selecting DDL item based on TEXT? Why isn't this working? darrel ASP .Net 4 08-17-2007 03:15 PM
Selecting an item in a drop down list KatMagic ASP .Net 3 04-11-2006 07:25 PM
Re: Selecting an item in a drop down list Natty Gur ASP .Net 1 08-18-2003 02:40 PM
Selecting an item in a drop down list Bogdan Zamfir ASP .Net 2 08-17-2003 10:06 PM
Programmatically Selecting Item in Radio Button List John Criswell ASP .Net 1 07-24-2003 07:07 PM



Advertisments