Classic ASP VBScript: Passing a static jumpmenu value to a query page

WIN XP PRO
DWMX
Classic ASP VBScript
MS Access

Hello.  Could someone, please, assist me with passing a jumpmenu value to another page containing a query?  I have created a jumpmenu via DW's behavior.  It simply contains a list of the 50 state abbreviations.  When a state is selected, I would like to pass that "value" of the abbreviation to the next page which will contain a query to display all cities for the state selection being passed.  The query is pulling from an MS Access database table titled "Cities" and has a column/field for "state_abbrev", however, the jumpmenu is static.

Is this possible?

Thanks so much,
Shane
lshaneAsked:
Who is Participating?
 
bugs021997Connect With a Mentor Commented:
Change the form which contains the DROPDOWN as below.....

<form name="form1" method="post" action="">
<select name="form_state" id="form_state" onChange="MM_jumpMenu('parent',this,0)">
  <option selected>-:State:-</option>
  <option value="search_test.asp?abb=AK">AK</option>

  <option value="search_test.asp?abb=AL">AL</option>
  <option value="search_test.asp?abb=AR">AR</option>
  <option value="search_test.asp?abb=AZ">AZ</option>
  <option value="search_test.asp?abb=CA">CA</option>
</select>
</form>









Change the Recordset page code as below...
------------------------------------------------------------------------------------------------------------------------
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/conn_bargaindata.asp" -->
<%
Dim rsCitiesList__MMColParam
rsCitiesList__MMColParam = "1"
If (Request("abb") <> "") Then
  rsCitiesList__MMColParam = Request("abb")
End If
%>
<%
Dim rsCitiesList
Dim rsCitiesList_numRows

Set rsCitiesList = Server.CreateObject("ADODB.Recordset")
rsCitiesList.ActiveConnection = MM_conn_bargaindata_STRING
rsCitiesList.Source = "SELECT * FROM cities WHERE stateabbreviation = '" + Replace(rsCitiesList__MMColParam, "'", "''") + "' ORDER BY city ASC"
rsCitiesList.CursorType = 0
rsCitiesList.CursorLocation = 2
rsCitiesList.LockType = 1
rsCitiesList.Open()

rsCitiesList_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
rsCitiesList_numRows = rsCitiesList_numRows + Repeat1__numRows
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<table width="200" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <%
While ((Repeat1__numRows <> 0) AND (NOT rsCitiesList.EOF))
%>
    <td><%=(rsCitiesList.Fields.Item("city").Value)%></td>
    <%
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  rsCitiesList.MoveNext()
Wend
%>
</tr>
</table>
</body>
</html>
<%
rsCitiesList.Close()
Set rsCitiesList = Nothing
%>
------------------------------------------------------------------------------------------------------------------------
0
 
bugs021997Commented:
<script language="JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
             
            <select name="select" onChange="MM_jumpMenu('parent',this,1)">
              <option value="dreamweaver_tips.asp" selected>Dreamweaver Tips</option>
              <option value="/Fireworks/default.asp">Fireworks Tutorials</option>
              <option value="/Flash/default.asp">Flash Tutorials</option>
              <option value="/website_design/default.asp">Web Design Tutorials</option>
            </select>
            
0
 
bugs021997Commented:
You can even simply do this...

<form name="jump">
   <select name="menu" onchange="location=document.jump.menu.options[document.jump.menu.selectedIndex].value;" value="GO">
 
    <option value="GO" selected="selected" >Browse topic:</option>
    <option value="yourExecutablePage.asp" >Movies</option>
    <option value="yourExecutablePage.asp">Culture</option>
    <option value="yourExecutablePage.asp">World News</option>
 
</select>
 
</form>
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
lshaneAuthor Commented:
Thanks, bugs.  I was actually able to create the jumpmenu via the behavior.  I just have the same destination page for each of the listed states; however, I would like that state abbreviation (i.e. "GA") value to be passed in the URL for the destination page to query.  The problem is that when it "jumps" to the destination page, nothing happens.  Just blank.  It's almost like the query/recordset  is not seeing a value (i.e. "GA") to process.

Here are the test page links:

"Jump" page: <http://mizb.readyhosting.com/search_listings_test.asp>

Recordset page: <http://mizb.readyhosting.com/search_test.asp>

Here is the Recordset page code:
------------------------------------------------------------------------------------------------------------------------
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/conn_bargaindata.asp" -->
<%
Dim rsCitiesList__MMColParam
rsCitiesList__MMColParam = "1"
If (Request.Form("state_abbrev") <> "") Then
  rsCitiesList__MMColParam = Request.Form("state_abbrev")
End If
%>
<%
Dim rsCitiesList
Dim rsCitiesList_numRows

Set rsCitiesList = Server.CreateObject("ADODB.Recordset")
rsCitiesList.ActiveConnection = MM_conn_bargaindata_STRING
rsCitiesList.Source = "SELECT * FROM cities WHERE stateabbreviation = '" + Replace(rsCitiesList__MMColParam, "'", "''") + "' ORDER BY city ASC"
rsCitiesList.CursorType = 0
rsCitiesList.CursorLocation = 2
rsCitiesList.LockType = 1
rsCitiesList.Open()

rsCitiesList_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
rsCitiesList_numRows = rsCitiesList_numRows + Repeat1__numRows
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<table width="200" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <%
While ((Repeat1__numRows <> 0) AND (NOT rsCitiesList.EOF))
%>
    <td><%=(rsCitiesList.Fields.Item("city").Value)%></td>
    <%
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  rsCitiesList.MoveNext()
Wend
%>
</tr>
</table>
</body>
</html>
<%
rsCitiesList.Close()
Set rsCitiesList = Nothing
%>
------------------------------------------------------------------------------------------------------------------------

Thank you,
Shane
0
 
lshaneAuthor Commented:
Hi, bugs.  That worked great!  Thank you.
I do have one addendum question, and feel fee to tell me if I need to post another question:

On the Recordset page ("search_test.asp"), I have the results listed in a dropdown menu.  I would like to be able to select the respective City or County and either have it "jump" to another screen displaying the appropriate query, or have a "GO" button pointing to another screen displaying the appropriate query/recordset.

You can see my progress so far:
<http://mizb.readyhosting.com/search_listings_test.asp>
<http://mizb.readyhosting.com/search_test.asp>

0
 
lshaneAuthor Commented:
Thanks so much, bugs.  That was a tremendous help.  I posted another question regarding the jumpmenu retaining its selection when loading back to itself.

Thanks so much,
Shane
0
 
bugs021997Commented:
@Ishane

It was my pleasure to help you...i have posted my comments in your new question as well.

Cheers...

BUGS ^_^
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.