Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: help creating a jump menu from a database...


Message #1 by "Jeff" <jdupont@j...> on Wed, 31 Jan 2001 21:38:51 -0000
I'm trying to create a jump menu that reads from a database... not

difficult. Reading the database for each option is the easy part. The

problem I'm having is that it's part of a 3 page table... meaning that the

top row executes 1 asp page and then the other 2 columns execute 2 other

asp pages... all access a database. Now I currently have it set up with

the list menu and a submit button... but I want to set it up as a jumpmenu

so when you highlight a selection it'll change the rest of the page

accordingly. The current code is this:



<!-- #INCLUDE FILE="Connection.asp" -->

<html>

<head>

<title>newtest</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">



<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>

</head>

<body bgcolor="#FFFFFF" background="../img/ferrismain_bottom.jpg" bgproperties="fixed" text="#FFFFFF">

<% 

dim i

i = 0

Set objComm = Server.CreateObject("ADODB.Command")

objComm.ActiveConnection = strConn

objComm.CommandText = "SELECT location FROM location ORDER BY location

ASC"

objComm.CommandType = adCmdText

Set objRS = objComm.Execute

Set objComm = nothing

%> 

<form name="location" action="newtest.asp" method="post">

  <p> 

    <select name="park" onChange="MM_jumpMenu('parent',this,0)">

      <option value="0" selected>Select a location... </option>

      <% Do while not objRS.EOF

set location = objRS.Fields("Location")

i = i + 1

%>

      <option value="<% = i %>"> 

      <% = location %>

      </option>

      <%



objRS.movenext

Loop

objRS.Close

set objRS = Nothing

i = 0

%>

    </select>

  </p>

</form>

<table width="100%" border="0" cellspacing="0" cellpadding="0">

  <tr>

    <td width="55%" valign="top"> <%

     server.execute "newtest2.asp"

    %> </td>

    <td width="45%" align="left" valign="top"> <%

     server.execute "newtest3.asp"

    %> </td>

  </tr>

</table>



</body>

</html>



The problem I'm having is that the jumpmenu sends it to the value of 'i'

rather than posting 'i' as newtest.asp?park=i

Please help


  Return to Index