61 users online (1 members and 60 guests)  


  Results 1 to 5 of 5

Related

  1. Replies: 0
  2. Replies: 11
  3. Dropdown menu hides behind dropdown box    Forum: Javascript Forum
    Replies: 0
  4. Dropdown Menu    Forum: HTML Forum
    Replies: 1
  5. Replies: 1
  1. #1
    kperrin's Avatar
    New User

    Status
    Offline
    Join Date
    Nov 2003
    Posts
    2

    Post Dynamically populate a text field after making dropdown menu selection

    Does anyone know how to dynamically populate a text field based upon making a selection from a (database populated) dropdown menu?

    Thanks in advance!

  2. #2
    Doorknob's Avatar
    Super Newbie

    Status
    Offline
    Join Date
    Jun 2002
    Location
    Malaysia
    Posts
    316
    You can use Javascript to populate a text field after making a choice from a dropdown menu. At least, I think this is what you want. If this isn't what you want, please be more specific next time

    <head>
    <script language=Javascript>
    function Choice()
    {
    test.Populate.value = test.blah.value;
    }
    </script>
    </head>

    <form name=test....>
    <select name=blah onChange='Choice();'>
    <option value=1>1</option>
    <option value=1>1</option>
    <option value=1>1</option>
    </select>
    <input type=text name=Populate Disabled....>
    </form>

  3. #3
    kperrin's Avatar
    New User

    Status
    Offline
    Join Date
    Nov 2003
    Posts
    2
    Hi,

    How would this work if the dropdown menu is being dynamically populated from a database?

    Example:
    <form><select name="d1" size="1"><% Do While Not rs.EOF %>
    <option value="<%= rs("ISO_ID") %>"><%= rs("ISO_Element_Number") & " " & rs("ISO_Element_Description")%></option><% rs.movenext %><% loop %></select></form>

    After a selection has been made in the dropdown menu, I want to dynamically populate a text field with data from the same database table. Does that make sense?
    ___________________________________

    Quote Originally Posted by Doorknob
    You can use Javascript to populate a text field after making a choice from a dropdown menu. At least, I think this is what you want. If this isn't what you want, please be more specific next time

    <head>
    <script language=Javascript>
    function Choice()
    {
    test.Populate.value = test.blah.value;
    }
    </script>
    </head>

    <form name=test....>
    <select name=blah onChange='Choice();'>
    <option value=1>1</option>
    <option value=1>1</option>
    <option value=1>1</option>
    </select>
    <input type=text name=Populate Disabled....>
    </form>

  4. #4
    HTML's Avatar
    Administrator

    Status
    Offline
    Join Date
    Aug 2000
    Posts
    3,445

    Follow HTML On Twitter Add HTML on Facebook Add HTML on Google+ Add HTML on Linkedin Visit HTML's Youtube Channel
    moving to scripts

  5. #5
    Doorknob's Avatar
    Super Newbie

    Status
    Offline
    Join Date
    Jun 2002
    Location
    Malaysia
    Posts
    316
    <head>
    <script language=Javascript>
    function Choice()
    {
    form1.d1.value = form1.textField.value;
    }
    </script>
    </head>

    <form name=form1>
    <select name="d1" size="1">
    <%
    Do While Not rs.EOF
    response.write "<option value=" & rs("ISO_ID") & ">"
    response.write rs ("ISO_Element_Number") & " "
    response.write rs("ISO_Element_Description") & "</option>"
    rs.movenext
    loop
    %>
    </select>
    <input type=text name=textField Disabled....>
    </form>

    hope that helps