Web Analytics Made Easy -
StatCounter Dynamic List/Recordset Question - CodingForum

Announcement

Collapse
No announcement yet.

Dynamic List/Recordset Question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dynamic List/Recordset Question

    I have a page with two list boxes on it (lstType and lstLocation). In "lstType" here are two choices "Store-to-Store" and "Store-to-Warhouse". The "lstLocation" list box needs to be dynamically populated via a database query depending on which one of the two choices the user makes in the "lstType" list box. I have two recordsets created already for the page. Anyone?

  • #2
    Sorry, I forgot to post the code:


    <%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
    <!--#include file="Connections/GNR.asp" -->
    <%
    var sts_lookup = Server.CreateObject("ADODB.Recordset");
    sts_lookup.ActiveConnection = MM_GNR_STRING;
    sts_lookup.Source = "SELECT STORE_CD, STORE_NAME FROM STORE WHERE STORE_TP_CD ='S' ORDER BY STORE_NAME";
    sts_lookup.CursorType = 0;
    sts_lookup.CursorLocation = 2;
    sts_lookup.LockType = 1;
    sts_lookup.Open();
    var sts_lookup_numRows = 0;
    %>
    <%
    var stw_lookup = Server.CreateObject("ADODB.Recordset");
    stw_lookup.ActiveConnection = MM_GNR_STRING;
    stw_lookup.Source = "SELECT STORE_CD, STORE_NAME FROM STORE WHERE STORE_TP_CD ='W' ORDER BY STORE_NAME";
    stw_lookup.CursorType = 0;
    stw_lookup.CursorLocation = 2;
    stw_lookup.LockType = 1;
    stw_lookup.Open();
    var stw_lookup_numRows = 0;




    td><form name="form1" method="post" action="">
    <select name="lstType" size="1" id="lstType">
    <option value="STS">Store-to-Store</option>
    <option value="STW">Store-to-Warehouse</option>
    </select>
    </form></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td><form name="form2" method="post" action="">
    <select name="lstLocation" size="1" id="lstLocation">
    <%
    while (!sts_lookup.EOF) {
    %>
    <option value="<%=(sts_lookup.Fields.Item("STORE_CD").Value)%>"><%=(sts_lookup.Fields.Item("STORE_NAME").Val ue)%></option>
    <%
    sts_lookup.MoveNext();
    }
    if (sts_lookup.CursorType > 0) {
    if (!sts_lookup.BOF) sts_lookup.MoveFirst();
    } else {
    sts_lookup.Requery();
    }
    %>
    </select>
    </form></td>

    Comment

    Working...
    X