dynamic list menues - onchange event submit form to itself

I simply have two list boxes on a page.  The first one is populated dynamically from the an access recordset.  When a change occurs here, I would like to submit the page to itself, storing the value of the item selected.  Then the second dropdown is populatd from another recordset based on the first item.  I finally have a submit button that goes to another page.
I have searched the net, but all of the examples I see are only self submiting.  I want to self submit the form only when the onchange event occurs.  Then when the button is clicked submit normally to the next page.

I do not want to do this client side.  I want it simple, an easy call back to server, the lists will be between 50 and 150.

MY CODE:
<%
Dim rsbuildings
Dim rsbuildings_numRows

Set rsbuildings = Server.CreateObject("ADODB.Recordset")
rsbuildings.ActiveConnection = MM_waste_STRING
rsbuildings.Source = "SELECT DISTINCT BuildingID, BuildingName FROM Buildings"
rsbuildings.CursorType = 0
rsbuildings.CursorLocation = 2
rsbuildings.LockType = 1
rsbuildings.Open()

rsbuildings_numRows = 0
%>
<%
Dim rsRooms__MMColParam
rsRooms__MMColParam = "1"
If (Request.Form("List1") <> "") Then
  rsRooms__MMColParam = Request.Form("List1")
End If
%>
<%
Dim rsRooms
Dim rsRooms_numRows

Set rsRooms = Server.CreateObject("ADODB.Recordset")
rsRooms.ActiveConnection = MM_waste_STRING
rsRooms.Source = "SELECT RoomID FROM Buildings WHERE BuildingID = " + Replace(rsRooms__MMColParam, "'", "''") + ""
rsRooms.CursorType = 0
rsRooms.CursorLocation = 2
rsRooms.LockType = 1
rsRooms.Open()

rsRooms_numRows = 0
%>


Then in the form:
<select name="list1" id="list1">
                      <option value="Select One">Select One</option>
                      <%
While (NOT rsbuildings.EOF)
%>
                      <option value="<%=(rsbuildings.Fields.Item("BuildingID").Value)%>"><%=(rsbuildings.Fields.Item("BuildingName").Value)%></option>
                      <%
  rsbuildings.MoveNext()
Wend
If (rsbuildings.CursorType > 0) Then
  rsbuildings.MoveFirst
Else
  rsbuildings.Requery
End If
%>
                    </select>

...

<select name="list2" id="list2">
                      <option value="Select One">Select One</option>
                      <%
While (NOT rsRooms.EOF)
%>
                      <option value="<%=(rsRooms.Fields.Item("RoomID").Value)%>"><%=(rsRooms.Fields.Item("RoomID").Value)%></option>
                      <%
  rsRooms.MoveNext()
Wend
If (rsRooms.CursorType > 0) Then
  rsRooms.MoveFirst
Else
  rsRooms.Requery
End If
%>
                    </select>
jhmoenAsked:
Who is Participating?
 
fritz_the_blankCommented:
Okay and good luck.

I realize that this may not have been as easy as you hoped (that is why I wrote the article) but I hope that you got something out of writing this page.

FtB
0
 
fritz_the_blankCommented:
I wrote an artilce on this, but it does require some client-side code:

http://www.fairfieldconsulting.com/asp_multipleSelects.asp

Essentially, the form keeps on submitting to itself with each select (the onChange method). Then when you are done, you press submit which dynamically changes the action of the form and then submits to a processing page.

FtB
0
 
jhmoenAuthor Commented:
Okay,
I have tried to implement your example.  Would you mind taking a look at my relavent code here...I am not familiar with how to set up these connection strings and am not sure if I did it correctly.  In past pages I have set up a session connection string. Also, is it possible to have the first list box display the Building Name but have the value of BuildingID? (see my sql)  I don't have three menue's, just two.  

My connections seem to be wrong...I have increased the points if you stay with me!! Thanks.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
  Response.Buffer = True
  Response.ExpiresAbsolute = Now() - 1
  Response.Expires = 0
  Response.CacheControl = "no-cache"
%>
<!--#include virtual="/includes/randomizer.inc" -->
<!--#include virtual="/Connections/ehs.asp" -->
<%
dim strBuilding, strRoom, oConn, strSelected
'open database connection
set oConn = server.CreateObject("ADODB.Connection")
oConn.ConnectionString = session("connString2")
oConn.Open

strBuilding = Request.Form("Building")
strRegion = Request.Form("Room")

sub makeBuilding()
     if not isObject("oConn") then
          set oConn=Server.CreateObject("ADODB.RecordSet")
     end if
     if oConn.state <> 0 then
          oConn.close
     end if
     oConn.Open "SELECT DISTINCT BuildingID, BuildingName  FROM Buildings ORDER BY BuildingName",objConnection,3,3
     Response.Write("<option></option>" & VBCRLF )
     do while not oConn.EOF
          if oConn("Building") = strBuilding then
               strSelected = " Selected "
          else
               strSelected = ""
          end if
          Response.Write("<option" & strSelected & ">" & oConn("Building") & "</option>" & VBCRLF )
          oConn.MoveNext
     loop
     oConn.Close
     set oConn=Nothing
end sub

sub makeRoom()
     if strBuilding <> "" then
          if not isObject("oConn") then
               set oConn=Server.CreateObject("ADODB.RecordSet")
          end if
          if oConn.state <> 0 then
               oConn.close
          end if
          oConn.Open "SELECT RoomID FROM Buildings WHERE BuildingID = '" & strBuilding & "' ORDER BY Romm",objConnection,3,3
          if oConn.eof then
               Response.Write("<option>No Rooms Found</option>")
          else
               Response.Write("<option>Select Room Now</option>" & VBCRLF )
               do while not oConn.EOF
                    if oConn("Room") = strRoom then
                         strSelected = " Selected "
                    else
                         strSelected = ""
                    end if
                    Response.Write("<option" & strSelected & ">" & oConn("Room") & "</option>" & VBCRLF )
                    oConn.MoveNext
               loop
          end if
          oConn.Close
          set oConn=Nothing
     else
          Response.Write("<option>Select a Building First</option>")
     end if
end sub
%>
<html>
<head>
<title>none - none </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="/includes/style.css" rel="stylesheet" type="text/css">
<script>
<!--

function submitBuilding(){
var objForm = document.forms[0];
objForm.elements['Room'].selectedIndex=0;
objForm.submit();
}
function submitForm(){
var objForm = document.forms[0];
objForm.action = "pickup.asp"
return true;
}

//-->
</script>

MY HTML FORM:
<FORM action="default.asp" encType=x-www-form-urlencoded id=request method=post name=request onSubmit="return submitForm()">
              <TABLE width=100% border=1 cellPadding=0 cellSpacing=2 bordercolor="#CCCCCC">
                <tr>
                  <td colspan=2><p><span class=globalText>Please select your building and room from where you wish to have waste picked up. You may be asked to enter general PI Information. </span><br>
                      <br>
                    </p></td>
                </tr>
                <TR>
                  <TD width="44%"><p><strong>1. Select your building </strong></p></TD>
                  <TD width="56%"><p>
                <SELECT name="Building" onChange="submitBuilding()">
                    <%call makeBuilding%>
                        </SELECT><br>
                  <span class=globalText></span></p></TD>
                </TR>
                <!--<TR>
            <TD><span class=title>Principal Investigator:</span></TD>
            <TD><span class=globalText><INPUT maxLength=50 name=Name size=30> Last name, First name</span></TD>
      </TR>-->
                <TR>
                  <TD><p><strong>2. Select your room/area </strong></p></TD>
                  <TD><p>
                  <SELECT name="Room">
                          <%call makeRoom%>
                          </SELECT>
                    </p></TD>
                </TR>
                <TR>
                  <TD>&nbsp;</TD>
                  <TD><input name=action type=submit class="form" value="Continue &gt;&gt;"></TD>
                </TR>
              </TABLE>
</FORM>

CLOSE THE CONNECTION AT END OF PAGE:
<%
oConn.Close
set oConn = Nothing
%>

0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
fritz_the_blankCommented:
I don't have time to look at all of this tonight, but it seems to me that you have to make a distinction between connection objects and recordset objects....

this should be closer, but I can't test here:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
  Response.Buffer = True
  Response.ExpiresAbsolute = Now() - 1
  Response.Expires = 0
  Response.CacheControl = "no-cache"
%>
<!--#include virtual="/includes/randomizer.inc" -->
<!--#include virtual="/Connections/ehs.asp" -->
<%
dim strBuilding, strRoom, oConn, strSelected
'open database connection
set oConn = server.CreateObject("ADODB.Connection")
oConn.ConnectionString = session("connString2")
oConn.Open

strBuilding = Request.Form("Building")
strRoom = Request.Form("Room")

sub makeBuilding()
     if not isObject("oConn") then
          set objRS_Building=Server.CreateObject("ADODB.RecordSet")
     end if
     objRS_Building.Open "SELECT DISTINCT BuildingID, BuildingName  FROM Buildings ORDER BY BuildingName",oConn,3,3
     Response.Write("<option></option>" & VBCRLF )
     do while not objRS_Building.EOF
          if objRS_Building("Building") = strBuilding then
               strSelected = " Selected "
          else
               strSelected = ""
          end if
          Response.Write("<option" & strSelected & ">" & objRS_Building("Building") & "</option>" & VBCRLF )
          objRS_Building.MoveNext
     loop
     objRS_Building.Close
     set objRS_Building=Nothing
end sub

sub makeRoom()
     if strBuilding <> "" then
          if not isObject("oConn") then
               set objRS_Room=Server.CreateObject("ADODB.RecordSet")
          end if
          objRS_Room.Open "SELECT RoomID FROM Buildings WHERE BuildingID = '" & strBuilding & "' ORDER BY Romm",oConn,3,3
          if  objRS_Room.eof then
               Response.Write("<option>No Rooms Found</option>")
          else
               Response.Write("<option>Select Room Now</option>" & VBCRLF )
               do while not  objRS_Room.EOF
                    if  objRS_Room("Room") = strRoom then
                         strSelected = " Selected "
                    else
                         strSelected = ""
                    end if
                    Response.Write("<option" & strSelected & ">" &  objRS_Room("Room") & "</option>" & VBCRLF )
                     objRS_Room.MoveNext
               loop
          end if
           objRS_Room.Close
          set  objRS_Room=Nothing
     else
          Response.Write("<option>Select a Building First</option>")
     end if
end sub
%>


FtB
0
 
jhmoenAuthor Commented:
Thanks,
whenever you get a minute.

The error is:
Microsoft JET Database Engine (0x80004005)
Disk or network error.
/testhazform/default.asp, line 15  

LINE 15 IS: oConn.Open

I will keep looking at it.
0
 
fritz_the_blankCommented:
That is a connection error that really has little to do with the problem at hand. Were you able to connect to your database before?

Here are a few links for you:

http://support.microsoft.com/default.aspx?scid=kb;EN-US;q306518
http://www.webwizguide.info/asp/faq/access_database_faq.asp

FtB
0
 
jhmoenAuthor Commented:
I raised the points....I'm desperate.
Okay,
I am getting closer here.
I can connect to the database great now.  Also, the first listbox is being populated with the BuildingID and the second listbox says "Select a Building first", however, upon selecting a BuildingID from first listbox, nothing happens.  Not sure if my onchange event is working for first list, but should be correct??

ALSO, is it possible to show the BuildingName as the Select Label and have the BuildingID as the actual Select value??

HERE IS WHAT I HAVE GOT:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
  Response.Buffer = True
  Response.ExpiresAbsolute = Now() - 1
  Response.Expires = 0
  Response.CacheControl = "no-cache"
%>
<!--#include virtual="/includes/randomizer.inc" -->
<!--#include virtual="/Connections/ehs.asp" -->
<%
dim strBuilding, strRoom, oConn, strSelected, objRS_Building
'open database connection
set oConn = server.CreateObject("ADODB.Connection")
oConn.ConnectionString = session("connString2")
oConn.Open

strBuilding = Request.Form("Building")
strRoom = Request.Form("Room")

sub makeBuilding()
     if not isObject("oConn") then
          set objRS_Building=Server.CreateObject("ADODB.RecordSet")
     end if
     objRS_Building.Open "SELECT DISTINCT BuildingID, BuildingName  FROM Buildings ORDER BY BuildingName",oConn,3,3
     Response.Write("<option></option>" & VBCRLF )
     do while not objRS_Building.EOF
          if objRS_Building("BuildingID") = strBuilding then
               strSelected = " Selected "
          else
               strSelected = ""
          end if
          Response.Write("<option" & strSelected & ">" & objRS_Building("BuildingID") & "</option>" & VBCRLF )
          objRS_Building.MoveNext
     loop
     objRS_Building.Close
     set objRS_Building=Nothing
end sub

sub makeRoom()
     if strBuilding <> "" then
          if not isObject("oConn") then
               set objRS_Room=Server.CreateObject("ADODB.RecordSet")
          end if
          objRS_Room.Open "SELECT RoomID FROM Buildings WHERE BuildingID = '" & strBuilding & "' ORDER BY RoomID",oConn,3,3
          if  objRS_Room.eof then
               Response.Write("<option>No Rooms Found</option>")
          else
               Response.Write("<option>Select Room Now</option>" & VBCRLF )
               do while not  objRS_Room.EOF
                    if  objRS_Room("Room") = strRoom then
                         strSelected = " Selected "
                    else
                         strSelected = ""
                    end if
                    Response.Write("<option" & strSelected & ">" &  objRS_Room("Room") & "</option>" & VBCRLF )
                     objRS_Room.MoveNext
               loop
          end if
           objRS_Room.Close
          set  objRS_Room=Nothing
     else
          Response.Write("<option>Select a Building First</option>")
     end if
end sub
%>

MY JAVASCRIPT:
<script>
<!--
function submitBuilding(){
var objForm = document.forms[0];
objForm.elements['Room'].selectedIndex=0;
objForm.submit();
}
function submitForm(){
var objForm = document.forms[0];
objForm.action = "pickup.asp"
return true;
}

//-->
</script>

AND MY SELECTS:

<SELECT name="Building" onChange="submitBuilding()">
                    <%call makeBuilding%>
</SELECT><br>

<SELECT name="Room">
          <%call makeRoom%>
</SELECT>

THANKYOU FRITZ THE BLANK!
0
 
jhmoenAuthor Commented:
Error: objForm.elements.Room has no propterties
0
 
fritz_the_blankCommented:
Sorry not to have responded earlier, but I am teaching at the university today and won't be back until later today.

I think that both of these issues are related--do you have a form, and only one form on your page?

FtB

0
 
jhmoenAuthor Commented:
yes only one form.
0
 
fritz_the_blankCommented:
This error here:

Error: objForm.elements.Room has no propterties

indicates that either you don't have a form or the name of the field is not Room. Please post all of your code as you have it now and I'll look at it when I finish teaching this afternoon.

FtB
0
 
jhmoenAuthor Commented:
I appreciate that.
Form Name  is "request"
Listbox 1 is "Building"
Listbox 2 is "Room"

HERE IS THE WHOLE PAGE:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
  Response.Buffer = True
  Response.ExpiresAbsolute = Now() - 1
  Response.Expires = 0
  Response.CacheControl = "no-cache"
%>
<!--#include virtual="/includes/randomizer.inc" -->
<!--#include virtual="/Connections/ehs.asp" -->
<%
dim strBuilding, strRoom, oConn, strSelected, objRS_Building
'open database connection
set oConn = server.CreateObject("ADODB.Connection")
oConn.ConnectionString = session("connString2")
oConn.Open

strBuilding = Request.Form("Building")
strRoom = Request.Form("Room")

sub makeBuilding()
     if not isObject("oConn") then
          set objRS_Building=Server.CreateObject("ADODB.RecordSet")
     end if
     objRS_Building.Open "SELECT DISTINCT BuildingID, BuildingName  FROM Buildings ORDER BY BuildingName",oConn,3,3
     Response.Write("<option></option>" & VBCRLF )
     do while not objRS_Building.EOF
          if objRS_Building("BuildingID") = strBuilding then
               strSelected = " Selected "
          else
               strSelected = ""
          end if
          Response.Write("<option" & strSelected & ">" & objRS_Building("BuildingID") & "</option>" & VBCRLF )
          objRS_Building.MoveNext
     loop
     objRS_Building.Close
     set objRS_Building=Nothing
end sub

sub makeRoom()
     if strBuilding <> "" then
          if not isObject("oConn") then
               set objRS_Room=Server.CreateObject("ADODB.RecordSet")
          end if
          objRS_Room.Open "SELECT RoomID FROM Buildings WHERE BuildingID = '" & strBuilding & "' ORDER BY RoomID",oConn,3,3
          if  objRS_Room.eof then
               Response.Write("<option>No Rooms Found</option>")
          else
               Response.Write("<option>Select Room Now</option>" & VBCRLF )
               do while not  objRS_Room.EOF
                    if  objRS_Room("Room") = strRoom then
                         strSelected = " Selected "
                    else
                         strSelected = ""
                    end if
                    Response.Write("<option" & strSelected & ">" &  objRS_Room("Room") & "</option>" & VBCRLF )
                     objRS_Room.MoveNext
               loop
          end if
           objRS_Room.Close
          set  objRS_Room=Nothing
     else
          Response.Write("<option>Select a Building First</option>")
     end if
end sub
%>

<html>
<head>
<title>Utah State University - Environmental Health &amp; Safety Resource Center</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="/includes/style.css" rel="stylesheet" type="text/css">
<script>
<!--

var position = 1;
Rollimage = new Array()

Rollimage[0]= new Image(559,52)
Rollimage[0].src = "/images/photo_secondary.jpg"

Rollimage[1] = new Image(559,145)
Rollimage[1].src = "/images/photo_main.jpg"

//clear searchbox
function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
}
//-->

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function Swapper()
{
      if (position == 1)
      {
            document.swap.src= Rollimage[1].src;
            position = 0;
      }
      else
      {
            document.swap.src= Rollimage[0].src;
            position = 1;
      }
}
function submitBuilding(){
var objForm = document.forms[0];
objForm.elements['Room'].selectedIndex=0;
objForm.submit();
}
function submitForm(){
var objForm = document.forms[0];
objForm.action = "pickup.asp"
return true;
}

//-->
</script>
</head>

<body onLoad="MM_preloadImages('/images/icons_chemical.gif','/images/icons_biological.gif','/images/icons_radiation.gif','/images/icons_waste.gif','/images/icons_maintenance.gif','/images/genhealth2.gif','/images/research2.gif','/images/maintenance2.gif','/images/enviromental2.gif','/images/about2.gif','/images/ask_ehs2.gif')">
<!--#include virtual="/includes/topbar.inc" -->
<!--#include virtual="/includes/browser.inc" -->
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="1" bgcolor="#333333"><img src="/images/spacer.gif" alt="" width="1" height="1"></td>
    <td width="199" valign="top">
<div align="center">
        <table width="199" border="0" cellpadding="0" cellspacing="0" id="leftnav">
          <tr>
            <td width="199" height="28" colspan="2" bgcolor="#6D6F71"><img src="/images/spacer.gif" alt="" width="199" height="28"></td>
          </tr>
          <tr>
            <td height="10" colspan="2"><img src="/images/spacer.gif" alt="" width="199" height="10"></td>
          </tr>
          <tr>
            <td width="20" rowspan="9" valign="top"><img src="/images/spacer.gif" alt="" width="20" height="1"></td>
            <td width="179" height="30" align="left" valign="middle" class="leftnav"><a href="/general/" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('genhealth','','/images/genhealth2.gif',1)"><img src="/images/genhealth1.gif" alt="General Health and Safety" name="genhealth" width="151" height="30" border="0"></a></td>
          </tr>
          <tr>
            <td width="179" height="45" align="left" valign="middle" class="leftnav"><a href="/research/" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('research','','/images/research2.gif',1)"><img src="/images/research1.gif" alt="Research and Laboratory Safety" name="research" width="106" height="45" border="0"></a></td>
          </tr>
          <tr>
            <td width="179" height="45" align="left" valign="middle" class="leftnav"><a href="/maintenance/" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('maintenance','','/images/maintenance2.gif',1)"><img src="/images/maintenance1.gif" alt="Maintenance and Construction Safety" name="maintenance" width="118" height="45" border="0"></a></td>
          </tr>
          <tr>
            <td width="179" height="24" align="left" valign="middle" class="leftnav"><a href="/environmental/" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('environmantal','','/images/enviromental2.gif',1)"><img src="/images/enviromental1.gif" alt="Environmental Programs" name="environmantal" width="144" height="30" border="0"></a></td>
          </tr>
          <tr>
            <td width="179" height="30" align="left" valign="middle" class="leftnav"><a href="/about/" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('about','','/images/about2.gif',1)"><img src="/images/about1.gif" alt="About Us" name="about" width="50" height="30" border="0"></a></td>
          </tr>
          <tr>
            <td height="19" align="left" valign="top"><a href="/ask/" onMouseOver="MM_swapImage('Image1','','/images/ask_ehs2.gif',1)" onMouseOut="MM_swapImgRestore()"><img src="/images/ask_ehs.gif" alt="Contact Us with any questions you have." name="Image1" width="150" height="30" border="0" id="Image1"></a></td>
          </tr>
        </table>
      </div></td>
    <td width="559" valign="top"><table width="559" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><% if request.QueryString("expand") = 1 then
                                    response.Write("<a href='default.asp'><img src='/images/mainphotos/" & strImage & "' alt='Click to detract image.' name='swap' border='0' id='swap'></a>")
                          else                  
                                    response.Write("<a href='default.asp?expand=1'><img src='/images/mainphotos/" & strThumb & "' alt='Click to expand image.' name='swap' border='0' id='swap'></a>")
                         end if %></td>
        </tr>
        <tr>
          <td><table width="559" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="2" rowspan="2" background="/images/breadshim.gif"><img src="/images/spacer.gif" width="2" height="1"></td>
                <td width="7" class="breadcrumb">&nbsp;</td>
                <td width="570" class="breadcrumb"><a href="/" class="breadcrumb">EHS
                  Home</a> &gt; <a href="default.asp" class="breadcrumb">Hazardous
                  Waste Pickup Request</a> &gt; You are here</td>
              </tr>
              <tr>
                <td height="1" colspan="2" bgcolor="#A6A6A6"><img src="/images/spacer.gif" width="1" height="1"></td>
              </tr>
            </table></td>
        </tr>
      </table>
      <table width="559" height="324" border="0" cellpadding="0" cellspacing="0" id="text">
        <tr>
          <td height="10" colspan="4"><img src="/images/spacer.gif" alt="" width="559" height="10"></td>
        </tr>
        <tr>
          <td width="381" height="26" valign="top" class="title"><span class=title>Hazardous
            Waste</span> Pickup Request</td>
          <td width="10" height="26"><img src="/images/spacer.gif" alt="" width="10" height="8"></td>
          <td width="160" height="26"><img src="/images/spacer.gif" alt="" width="160" height="8"></td>
          <td height="26"><img src="/images/spacer.gif" alt="" width="8" height="1"></td>
        </tr>
        <tr>
          <td width="381" height="144" valign="top"><FORM action="" encType=x-www-form-urlencoded id=request method=post name=request onSubmit="return submitForm()">
              <TABLE width=100% border=1 cellPadding=0 cellSpacing=2 bordercolor="#CCCCCC">
                <tr>
                  <td colspan=2><p><span class=globalText>Please select your building and room from where you wish to have waste picked up. You may be asked to enter general PI Information. </span><br>
                      <br>
                    </p></td>
                </tr>
                <TR>
                  <TD width="44%"><p><strong>1. Select your building </strong></p></TD>
                  <TD width="56%"><p>
                <SELECT name="Building" onChange="submitBuilding()">
                    <%call makeBuilding%>
                        </SELECT><br>
                  <span class=globalText></span></p></TD>
                </TR>
                <!--<TR>
            <TD><span class=title>Principal Investigator:</span></TD>
            <TD><span class=globalText><INPUT maxLength=50 name=Name size=30> Last name, First name</span></TD>
      </TR>-->
                <TR>
                  <TD><p><strong>2. Select your room/area </strong></p></TD>
                  <TD><p>
                  <SELECT name="Room">
                          <%call makeRoom%>
                          </SELECT>
                    </p></TD>
                </TR>
                <TR>
                  <TD>&nbsp;</TD>
                  <TD><input name=action type=submit class="form" value="Continue &gt;&gt;"></TD>
                </TR>
              </TABLE>
</FORM></td>
          <td width="10" height="144" valign="top" class="little"><img src="/images/spacer.gif" alt="" width="10" height="8"></td>
          <td width="160" valign="top" class="little"> </td>
          <td width="8" class="little"><img src="/images/spacer.gif" width="8" height="1"></td>
        </tr>
        <tr>
          <td height="1" valign="top"><img src="/images/spacer.gif" alt="" width="381" height="1"></td>
          <td height="1" valign="top" class="little"><img src="/images/spacer.gif" alt="" width="10" height="1"></td>
          <td height="1" valign="top" class="little"><img src="/images/spacer.gif" alt="" width="160" height="1"></td>
          <td height="1" class="little"><img src="/images/spacer.gif" width="8" height="1"></td>
        </tr>
      </table></td>
    <td width="1" bgcolor="#333333"><img src="/images/spacer.gif" alt="" width="1" height="1"></td>
  </tr>
  <tr>
    <td width="1" bgcolor="#333333"><img src="/images/spacer.gif" alt="" width="1" height="1"></td>
    <td colspan="2" valign="top"><table width="758" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="300" rowspan="2" valign="bottom"> <table width="220" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="20" rowspan="3"><img src="/images/spacer.gif" width="20" height="1"></td>
                <td width="200"><img src="/images/icons_browse.gif" alt="" name="icon_text" width="200" height="32" id="icon_text"></td>
              </tr>
              <tr>
                <td width="200"><img src="/images/icons.gif" alt="" name="icons" width="200" height="32" border="0" usemap="#iconsMap" id="icons"></td>
              </tr>
              <tr>
                <td width="200" height="15"><img src="/images/spacer.gif" width="1" height="15"></td>
              </tr>
            </table></td>
          <td width="505" height="65" colspan="2" align="right" valign="bottom"><!--#include virtual="/includes/jump.inc" --></td>
        </tr>
        <tr>
          <td width="497" height="20" align="right" valign="bottom" class="copyright"><!--#include virtual="/includes/copyright.inc" --></td>
          <td width="8" align="right" valign="bottom"><img src="/images/spacer.gif" width="8" height="1"></td>
        </tr>
      </table>
    <td width="1" bgcolor="#333333"><img src="/images/spacer.gif" alt="" width="1" height="1"></td>
  </tr>
  <tr>
    <td bgcolor="#333333"><img src="/images/spacer.gif" alt="" width="1" height="1"></td>
    <td colspan="3" valign="top" bgcolor="#333333"><img src="/images/spacer.gif" alt="" width="558" height="1"></td>
  </tr>
</table>
<map name="iconsMap">
  <area shape="rect" coords="162,2,191,30" href="/topics/waste.asp" alt="Waste" onMouseOver="MM_swapImage('icon_text','','/images/icons_waste.gif',1)" onMouseOut="MM_swapImgRestore()">
  <area shape="rect" coords="122,2,151,30" href="/topics/chemical.asp" alt="Chemical" onMouseOver="MM_swapImage('icon_text','','/images/icons_chemical.gif',1)" onMouseOut="MM_swapImgRestore()">
  <area shape="rect" coords="82,2,111,30" href="/topics/radiation.asp" alt="Radiation" onMouseOver="MM_swapImage('icon_text','','/images/icons_radiation.gif',1)" onMouseOut="MM_swapImgRestore()">
  <area shape="rect" coords="41,2,70,30" href="/topics/biological.asp" alt="Biological" onMouseOver="MM_swapImage('icon_text','','/images/icons_biological.gif',1)" onMouseOut="MM_swapImgRestore()">
  <area shape="rect" coords="2,2,31,30" href="/topics/maintenance.asp" alt="Maintenance" onMouseOver="MM_swapImage('icon_text','','/images/icons_maintenance.gif',1)" onMouseOut="MM_swapImgRestore()">
</map>
</body>
<%
oConn.Close
set oConn = Nothing
%>

</html>
0
 
fritz_the_blankCommented:
Okay, part of the problem is that you are using DreamWeaver--it is always going to be hard to predict what that will do to your code. Let me go through this...

FtB
0
 
fritz_the_blankCommented:
Okay, let's go through this:

1) does the page load with the contents in the first select?
2) If so, when you select something from the first list, does the page submit to itself?
3) is there a link wihere I can see this page in action?

FtB
0
 
jhmoenAuthor Commented:
1) The page does load with the contents in the first select.
2) The page does not submit to itself when a selection is made with the first select list
3) the test link is: http://www.ehs.usu.edu/testhazform/

Thanks.
0
 
fritz_the_blankCommented:
Okay, remember in http:#13825099 I asked if you only had one form and you said "yes"....well, you have multiple forms and that is why the code doesn't work as written!

Here is the fix:

function submitBuilding(){
var objForm = document.forms['request'];
objForm.elements['Room'].selectedIndex=0;
objForm.submit();
}
function submitForm(){
var objForm = document.forms['request'];
objForm.action = "pickup.asp"
return true;
}
0
 
fritz_the_blankCommented:
Next--

Change this line:

<SELECT name="Building" id="Building" onChange="submitBuilding">

to this"

<SELECT name="Building" id="Building" onChange="submitBuilding()">
0
 
jhmoenAuthor Commented:
Great looks like we are very close!!!!!!!!
How do I keep the first selected value in the first select box??

Check it out: http://www.ehs.usu.edu/testhazform/
0
 
jhmoenAuthor Commented:
sorry, its working locally, but not on server...gotta see again whats wrong.
0
 
jhmoenAuthor Commented:
Okay, its up
If you go here it works:       http://www.ehs.usu.edu/testhazform/default.asp
If you go here it does not work:     http://www.ehs.usu.edu/testhazform/

??

Anyway, is there a way to display the name of the building, but select the buildingID?  that is when you select "East Campus Office Building" the select value is 69.
Also can you keep "East Campus Office Building" in the select after it is chosen.

John
0
 
fritz_the_blankCommented:
try making the default action of the form default.asp perhaps?

Now these lines of code should keep the option selected:

strBuilding = Request.Form("Building")
strRoom = Request.Form("Room")

....

     do while not objRS_Building.EOF
          if objRS_Building("BuildingID") = strBuilding then
               strSelected = " Selected "
          else
               strSelected = ""
          end if
          Response.Write("<option" & strSelected & ">" & objRS_Building("BuildingID") & "</option>" & VBCRLF )
          objRS_Building.MoveNext
     loop


Perhaps if you do this instead:

if CStr(objRS_Building("BuildingID")) = strBuilding then

FtB
0
 
jhmoenAuthor Commented:
Okay, I think that is working!!
Let me test it for awhile in my app.
I will probably end up using the Building Name to display and use that as the unique identifier in the end, instead of the BuildingID (number).
So, no need to delineate between the two.

Thanks for all the hard work.  I will keep you posted.

John
0
 
jhmoenAuthor Commented:
fritx the blank,
Thanks again for you help and your great article on the dynamic linked lists.
I have successfully implemented it

I really appreciate all your help in getting it up and running!!!!

0
 
fritz_the_blankCommented:
You are very welcome.

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