Jump to content

bairdb

Members
  • Posts

    40
  • Joined

  • Last visited

Posts posted by bairdb

  1. <body><form method="get" action="Test.asp">Region  <select name="regn_nm" onchange="submit();"><option>GREAT LAKES REGION   <option>MIDLAND REGION       <option>MOUNTAIN REGION      <option>NORTHWEST REGION     <option>VALLEY REGION            </select>Sales St<select name="sales_st_nm" onchange="submit();"><option>ARIZONA NORTH        <option>ARIZONA SOUTH        <option>MIDLAND CENTRAL      <option>MIDLAND EAST         <option>MIDLAND NORTH        <option>MIDLAND WEST         </select></form></body></html>

    This is what the html looks like after I make a selection. the first dropdown value starts as Great Lakes Region when a page loads. If I select an option in the Region box it will create the second dropdown with the Sales States that correspond with the region that was selected, but after the Sales States dropdown loads, the region dropdown value goes back to Great Lakes Region even if I selected something different. I just want the Region dropdown to keep the value I selected after the Sales State dropdown loads.

  2. The problem I am having is, when you select the first dropdown box and the second dropdown populates from depending first selection, the first dropdown doesn't keep the selection that was made it goes back to the first option in the dropdown. I am looking for a way to keep each selection that is made.

  3. I have put together the code below to create dependant dropdown boxes. Can anyone help me with some javascript so the page works the same but doesn't refresh every time a dropdown box changes? I am relatively new to javascript so the more spefic the better. ThanksBairdb

    <%set object=Server.CreateObject("ADODB.recordset")sql="SELECT DISTINCT REGN_NM FROM 2005_SSP ORDER BY REGN_NM"object.Open sql,connREGN_NM=Trim(request("regn_nm"))%><a href="Test.asp">Refresh</a><form method="get" action="Test.asp">Region  <select name="regn_nm" onchange="submit();"><% do until object.EOF   response.Write("<option")   If object.fields("regn_nm") = regn_nm then   response.write(" selected")   end if   response.Write(">")   response.Write(object.fields("Regn_NM"))   object.Movenextloopobject.Closeset object=Nothing%>    </select><%If regn_nm<>"" thensql="SELECT DISTINCT SALES_ST_NM FROM 2005_SSP WHERE REGN_NM='"& regn_nm &"' ORDER BY SALES_ST_NM"set object=Server.CreateObject("ADODB.Recordset")object.Open sql,connSALES_ST_NM=Trim(request("sales_st_nm"))%>Sales St<select name="sales_st_nm" onchange="submit();"><% do until object.EOF   response.Write("<option")   If object.fields("sales_st_nm") = sales_st_nm then   response.write(" selected")   end if   response.Write(">")   response.Write(object.fields("sales_st_nm"))   object.Movenextloopobject.Closeset object=Nothing%></select><%End If%><%If sales_st_nm<>"" thensql="SELECT DISTINCT DST_CD FROM 2005_SSP WHERE SALES_ST_NM='"& sales_st_nm &"' ORDER BY DST_CD"set object=Server.CreateObject("ADODB.Recordset")object.Open sql,connDST_CD=Trim(request("dst_cd"))%>Distict <select name="dst_cd" onchange="submit();"><% do until object.EOF   response.Write("<option")   If object.fields("dst_cd") = dst_cd then   response.write(" selected")   end if   response.Write(">")   response.Write(object.fields("dst_cd"))   object.Movenextloopobject.Closeset object=Nothing%></select><%End If%></form><%If dst_cd<>"" thensql="TRANSFORM Sum([2005_SSP].PREMIUM_TOTAL) AS SumOfPREMIUM_TOTAL SELECT [2005_SSP].REGN_NM, [2005_SSP].SALES_ST_NM, [2005_SSP].DST_CD, [2005_SSP].LGCY_LINE_TYP_DESC FROM 2005_SSP WHERE Dst_Cd='"& dst_cd &"' GROUP BY   [2005_SSP].REGN_NM, [2005_SSP].SALES_ST_NM, [2005_SSP].DST_CD, [2005_SSP].LGCY_LINE_TYP_DESC PIVOT [2005_SSP].YR_MO;"set object=Server.CreateObject("ADODB.Recordset")object.Open sql,conn%><table width="100%"><tr><th>Region</th><th>Sales State</th><th>District</th><th>Line</th><th>Jan</th><th>Feb</th><th>Mar</td><th>Apr</td><th>May</td><th>Jun</td><th>Jul</td><th>Aug</td><th>Sep</td></tr><%do until object.EOF%><tr><%for each x in object.Fields%><td><%Response.Write Ucase(x.value)%></td><%nextobject.MoveNext%></tr><%loopobject.close%></table>

  4. I was wondering if anyone knows how to link combo boxes, that are populated from an access database, so if you click on a choice in one combo box it will display the associated data in the second combo box.

×
×
  • Create New...