passing value in a form

liunx

Guest
...I'm trying to pass a value from a drop-down menu of a form to an <input..> in the same form, but I don't know what the value of the input should be; for instance, the code is:<br />
<br />
<input type="hidden" name="item_number" value=""><br />
<br />
Pattern<select name=pattern><br />
<option name=A selected>A<br />
<option name=B>B</select><br />
<br />
<br />
All I want to do is pass the Pattern selection to the "item_number". Any suggestions?<br />
<br />
okh<!--content-->Looks like this is exactly what you are looking for<br />
<br />
Listbox populate text field (<!-- m --><a class="postlink" href="http://www.webapplikations.com/pages/html_js/forms/DropDownShowSelectionInTextField.html">http://www.webapplikations.com/pages/ht ... Field.html</a><!-- m -->)<!--content-->Try this:<br />
<br />
<form name=form0><br />
<input type="text" name="item_number" value=""> <br />
Pattern<br />
<select name=pattern <br />
onchange="this.form.item_number.value = this.form.pattern.selectedIndex;"><br />
<option name=A selected>A <br />
<option name=B>B<br />
<option name=C>C<br />
</select><br />
</form><br />
<br />
Bob<!--content-->...wow, Bob, I was hoping your suggestion would work because it was simple, but I'm afraid it didn't. I went and looked at the link Khalid pointed me too, but for some reason it's not working either. Here it is, if anyone could make a suggestion:<br />
<br />
<form id="form1" action="" onsubmit="" style="margin:auto;"><br />
<p><br />
<select name="prices" onchange="Process(this.options[this.selectedIndex].value)"><br />
<option value="-1" >Select Price</option><br />
<option value="25.36" >25.36</option><br />
<option value="19.98" >19.98</option><br />
<option value="36.95" >36.95</option><br />
</select><br />
<input type="text" name="t1"/><br />
</p><br />
</form><!--content-->Try this:<br />
<br />
<form action=""><br />
<p><select onchange="this.form.hidden.value = this.options[this.selectedIndex].value"><br />
<option value="zero">0</option><br />
<option value="one">1</option><br />
<option value="two">2</option><br />
</select></p><br />
<p><input type="hidden" name="hidden" value="zero"></p><br />
</form><!--content-->...that worked, pyro. Please accept my humble thanks! Hope I can learn more as I go along...<br />
<br />
okham<!--content-->Sure thing... Glad it worked for ya... :)<!--content-->
 
Back
Top