Windows Vista Forums

repopulate dropdown box
  1. #1


    RICK Guest

    repopulate dropdown box

    I would like to be able to repopulate a dropdown box from a database when the
    dropdown box is clicked. I cannot reload the entire page for this process.
    How can this be done. Here is my code for populating the dropdown when the
    page first loads.

    <select name="txtMonYearMonth" id="txtMonYearMonth" >
    <%
    qname="Webqry_SelectYearMon"
    Set rsFListMon = conn.execute(qname) %>
    <% if not rsFListMon.EOF then%>
    <option value selected = "New">New</option>
    <%
    rsFListMon.MoveFirst

    While Not rsFListMon.EOF
    strToken =rsFListMon.Fields("Token")
    strValue =rsFListMon.Fields("TrtYearMonth")

    %>
    <% if strToken = strRandomNumber then %>
    <option value="<% =strValue %>">
    <% =strValue %>
    </option>
    <% end if %>
    <% rsFListMon.MoveNext
    Wend



    rsFListMon.close
    Set rsFListMon = nothing
    %>
    </select>

      My System SpecsSystem Spec

  2. #2


    mr_unreliable Guest

    Re: repopulate dropdown box

    RICK wrote:

    > I would like to be able to repopulate a dropdown box
    hi rick,

    I'm not really sure about "repopulating" your dropdown,
    but how about "replacing" it.

    What I mean by that is to put your dropdown in a
    block tag (e.g., a span tag), and then when you are
    ready to "re-populate" just make up the new dropdown
    as a string, and use the (dhtml) "innerHTML" property
    to REPLACE your pre-existing dropdown.

    cheers, jw
    ____________________________________________________________

    You got questions? WE GOT ANSWERS!!! ..(but,
    no guarantee the answers will be applicable to the questions)

      My System SpecsSystem Spec

  3. #3


    RICK Guest

    Re: repopulate dropdown box

    I'm not completely sure I understand. Perhaps some example code would help.

    Thanks,

    Rick

    "mr_unreliable" wrote:

    > RICK wrote:

    > > I would like to be able to repopulate a dropdown box
    >
    > hi rick,
    >
    > I'm not really sure about "repopulating" your dropdown,
    > but how about "replacing" it.
    >
    > What I mean by that is to put your dropdown in a
    > block tag (e.g., a span tag), and then when you are
    > ready to "re-populate" just make up the new dropdown
    > as a string, and use the (dhtml) "innerHTML" property
    > to REPLACE your pre-existing dropdown.
    >
    > cheers, jw
    > ____________________________________________________________
    >
    > You got questions? WE GOT ANSWERS!!! ..(but,
    > no guarantee the answers will be applicable to the questions)
    >

      My System SpecsSystem Spec

  4. #4


    mr_unreliable Guest

    Re: repopulate dropdown box



    RICK wrote:

    > Perhaps some example code would help.
    >
    Try running the attached hta, and see if that's what
    you had in mind.

    cheers, jw

    <HEAD>
    <HTA:APPLICATION>
    </HEAD>
    <HTML>
    <BODY>
    <SCRIPT LANGUAGE="VBScript">
    Sub ReplaceDropDown()
    ' MsgBox("onClick Detected")
    sNewDropDown = "<select id=newEntries size=1 style='width:250px'>" _
    & "<option selected> Select a SuperModel </option>" _
    & "<option>Paula Pestova</option>" _
    & "<option>Elle MacPherson</option>" _
    & "<option>Heidi Klum</option>" _
    & "</select>"
    Window.Document.GetElementByID("dropdown").innerHTML = sNewDropDown
    End Sub
    </SCRIPT>

    <center>
    <span id=dropdown>
    <select id=entries size=1 style='width:250px'> _
    <option selected> Select a printer </option>
    <option>\\mail\HP 4000 - Admissions </option>
    <option>\\mail\HP 4000 - Business Office</option>
    <option>\\mail\HP 4100 - Clinical (Implants)</option>
    </select>
    </span>
    <BR><BR><BR><!-- space down a bit -->

    <button id=but0 onclick='ReplaceDropDown()' style="width:150">Replace Dropdown</button>
    </center>
    </BODY>
    </HTML>

      My System SpecsSystem Spec

  5. #5


    RICK Guest

    Re: repopulate dropdown box

    I don't see an hta

    "mr_unreliable" wrote:

    >
    >
    > RICK wrote:

    > > Perhaps some example code would help.
    > >
    > Try running the attached hta, and see if that's what
    > you had in mind.
    >
    > cheers, jw
    >

      My System SpecsSystem Spec

  6. #6


    Al Dunbar Guest

    Re: repopulate dropdown box

    If you saw an attachment called "ChangeDropDownDemo.hta.txt", save it under
    a name like "ChangeDropDownDemo.hta"

    /Al

    "RICK" <RICK@xxxxxx> wrote in message
    news:A719517D-E6AB-4C39-A895-A00F267FE3CC@xxxxxx

    >I don't see an hta
    >
    > "mr_unreliable" wrote:
    >

    >>
    >>
    >> RICK wrote:

    >> > Perhaps some example code would help.
    >> >
    >> Try running the attached hta, and see if that's what
    >> you had in mind.
    >>
    >> cheers, jw
    >>


      My System SpecsSystem Spec

repopulate dropdown box problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Autorun dropdown options went missing webdigr General Discussion 4 28 Oct 2009
Clearing a Dropdown Location Bar Riker General Discussion 0 01 Aug 2009
Autoplay Dropdown dubnikova General Discussion 1 26 Feb 2009
History dropdown operation Martin Vaupell Vista General 2 19 Apr 2007
HTML Dropdown boxes in IE7 =?Utf-8?B?SlRNLUhQ?= Vista General 4 21 Sep 2006