...

View Full Version : how to get the field id from a dropdown list



isaac_cm
07-10-2006, 12:56 AM
I populate a dropdown list with some values using javascript and after the user choose a value from the list he /she press a button to submit that value
for example "red"

I want to get the fild_id number for this value "red" and post it , how I can do that ?

please if you can supply few code snippets it helps much

thanks

_Aerospace_Eng_
07-10-2006, 01:06 AM
So you want to know which location the option was at, like first, second, third?

isaac_cm
07-10-2006, 11:38 AM
no I know about selectedindex
I have the following table :

f_id color
1 red
2 blue
3 green

I want to get the f_id value of the selected color, how I can do that ?

Beagle
07-10-2006, 03:30 PM
<form name="f">
<select name="s">
<option value="1">Red1</option>
<option value="2">Red2</option>
<option value="3">Red3</option>
<option value="4">Red4</option>
</select>
</form>

document.f.s.value will return the value of whatever is selected.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum