Skip navigation
Currently Being Moderated

ASP dynamic drop down

Jul 25, 2012 7:23 AM



I have a table in a database and I would like to populate a dropdown menu along with some fields from this table. When the user selects an option from the drop down menu I want the description to change as well.


I have dynamically populated the drop down menu but I am having difficulty in having the corresponding description change.


<select name="date" id="date">

       <% DO WHILE NOT objRS.EOF %>

       <option onchange="<% Response.Write objRS("id") %>" value="<% Response.Write objRS("date") %>"><% Response.Write objRS("date") %><input name="id" type="hidden" value="<% Response.Write objRS("id") %>" /></option>







Also I'm not sure how to update the information when an option is selected from the drop down menu without having to submit the from?


Hope some one can help!


Many thanks....

  • Currently Being Moderated
    Jul 25, 2012 10:09 AM   in reply to dips045

    If you want data on the page to change without resubmitting, you would need to use client side javascript. Since the javascript array would be populated from server side data, you need to use AJAX methods to transfer data between server and client code.  You might search for something like 'transfer recordset to javascript array' to find a specific example.

    Mark as:
  • Currently Being Moderated
    Jul 26, 2012 9:49 AM   in reply to dips045

    A form just posts the values from the fields it contains -including dropdowns - to a script. In the script you retrieve that posted value into a variable which you then use in a SQL statement WHERE clause. But it's still not clear what you are trying to do. If you are populating the dropdown from the database, then you can get the description at that time. Where are you trying to display the description?

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points