Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    May 2006
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how to get the field id from a dropdown list

    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

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    So you want to know which location the option was at, like first, second, third?
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    New Coder
    Join Date
    May 2006
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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 ?

  • #4
    Senior Coder
    Join Date
    Jul 2005
    Location
    New York, NY
    Posts
    1,084
    Thanks
    4
    Thanked 19 Times in 19 Posts
    <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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •