Hello, I have a form that enters information into a text field when an item is selected form a dropdown field. My question is I want to enter the price into different text field based what is selected from the drop down field. Below is what I have completed. I just cannot figure out the rest. I would appreciate any help. I am still new to this.
<html> <head> <script type="text/javascript"> function populate(item){ for(var i=0;i<item.form.elements.length;i++){ if(item==item.form.elements){ item.form.elements[i+1].value= item.options[item.selectedIndex].value; } } } ></script> </head> <body> <form> <select onchange="populate(this)"> <option value="">Select Product</option> <option value="(Shirt) (Long Sleve) (Linen Green) (WCB) (1x) (General) (500)">1A1</option> <option value="(Shirt)(Long Sleve)(Basket Green)(WCB)(1x)(General)(300)">1A2</option> <option value="(Shirt)(Long Sleve)(White)(WCB)(1x)(General)(200)(Enter Option)">1A3</option> <option value="(Shirt)(Long Sleve)(Linen Blue)(WCB)(1x)(General)(500)">1B1</option> <option value="(Shirt)(Long Sleve)(White)(WCB)(1x)(General)(500)">1B2</option> <option value="1(Shirt)(Short Sleve)(White)(WCB)(1x)(General)(500)">1C1</option> <option value="(Shirt)(Short Sleve)(White)(WCB)(1x)(General)(1000)">1C1A</option> <option value="(Shirt)(Short Sleve)(White) (WCB)(1x)(General)(2000)">1C1B</option> </select>
<table width="550" height="40" border="1"> <tr> <td width="534" height="35" align="center" valign="middle">
<input name="Product Ordering" type="text" id="Product Ordering" size="85">
<input name="Price" type="text" id="Price">
</td> </tr> </table>
</form> </body> </html>
<html> <head> <script type="text/javascript"> function populate(item){ for(var i=0;i<item.form.elements.length;i++){ if(item==item.form.elements){ item.form.elements[i+1].value= item.options[item.selectedIndex].value; } } } ></script> </head> <body> <form> <select onchange="populate(this)"> <option value="">Select Product</option> <option value="(Shirt) (Long Sleve) (Linen Green) (WCB) (1x) (General) (500)">1A1</option> <option value="(Shirt)(Long Sleve)(Basket Green)(WCB)(1x)(General)(300)">1A2</option> <option value="(Shirt)(Long Sleve)(White)(WCB)(1x)(General)(200)(Enter Option)">1A3</option> <option value="(Shirt)(Long Sleve)(Linen Blue)(WCB)(1x)(General)(500)">1B1</option> <option value="(Shirt)(Long Sleve)(White)(WCB)(1x)(General)(500)">1B2</option> <option value="1(Shirt)(Short Sleve)(White)(WCB)(1x)(General)(500)">1C1</option> <option value="(Shirt)(Short Sleve)(White)(WCB)(1x)(General)(1000)">1C1A</option> <option value="(Shirt)(Short Sleve)(White) (WCB)(1x)(General)(2000)">1C1B</option> </select>
<table width="550" height="40" border="1"> <tr> <td width="534" height="35" align="center" valign="middle">
<input name="Product Ordering" type="text" id="Product Ordering" size="85">
<input name="Price" type="text" id="Price">
</td> </tr> </table>
</form> </body> </html>