Forms values??

liunx

Guest
Hi im Tall Paul,<br />
Im not quite sure where i should be asking this since there's so many forums. So i put it in 'Introduction' and well i thought i'd get a response here!!<br />
<br />
I have a problem well more of a question. When using Forms and a drop dowN menu <br />
FORM<br />
SELECT<br />
OPTION......../OPTION<br />
OPTION......../OPTION<br />
OPTION......../OPTION<br />
/SELECT<br />
/FORM<br />
<br />
Once an option has been chosen. How do i get the value in between the OPTION brackets. I know the FORM returns the value but i dont know how to get the value<br />
<br />
I want to be able to pass it to an applet usin PARAM. I just want to get the value from the form<br />
<br />
By the way im using a servlet to generate the web page. So i can store the value in a variable.<br />
<br />
Anyone got any ideas? Did i explain myself enough?<br />
TallPaul<!--content-->You can use javascript to obtain the value which can then be used to initiate your object. .. or you can simply use javascript to add the option value to optioin text if you prefer.<br />
<br />
example<br />
<br />
<form><br />
<select name="myvalue"><br />
<option value="1">Number 1</option><br />
<option value="2">Number 2</option><br />
<option value="3">Number 3</option><br />
</select><br />
<br />
<input type="button" onclick="getValue(this.form)" value="go"><br />
</form><br />
<br />
<script><br />
function getValue(formName){<br />
selElm = formName.myvalue;<br />
selIndex = selElm.selectedIndex;<br />
selValue = selElm.options[selIndex].value;<br />
<br />
selElm.options[selIndex].text = selValue;<br />
}<br />
</script><br />
<br />
<br />
Note: the selElm.options[selIndex].text = selValue will move the value (e.g. "3" inside the brackets, e.g. <option value="3">3</option><br />
<br />
If you use javascript to initiate the object then simply use selValue to pass the values.<!--content-->
 
Back
Top