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 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2004
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question 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
    New Coder
    Join Date
    Jan 2004
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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>


  •  

    Posting Permissions

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