Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Components
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Components Discussions specific to components in ASP 3.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Components section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 1st, 2007, 05:23 PM
Registered User
 
Join Date: May 2007
Location: , CA, .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default combo box doesnt work in IE7 but Firefox

Hi all,

I was able to combine my dynamic drop down list to work with the data display.
However it only works in Firefox and Opera.

In IE7 i get to populate the Island list bit then it doesn't load the Dynamic hotel list.

I figure it might be something with the javascript and IE?
Or the way the form submits to populate the second box?

Maybe someone has an answer on what to change / amend?

The code is this:

<%@ Language = VBScript %>
<%Option Explicit%>
<%Response.Buffer = True%>
<HTML>
<HEAD>
<TITLE></TITLE>
<STYLE type="text/css">
@media all {
body, table, input {font-family: Arial; font-size: 9pt;}
h1 {font-family: Arial; font-size: 12pt; font-weight: bold;}
h2 {font-family: Arial; font-size: 10pt; font-weight: bold;}

/* General settings for tabel */
table {margin: 10px 0 10px 0; border-collapse: collapse;}
td {padding: 1px 4px 1px 0px; border: solid white; border-width: 2px 2px 2px 0;}
th {padding: 1px 4px 1px 0px; border: solid white; border-width: 2px 2px 2px 0; font-style: normal; font-weight: normal;}
}
</style>

<%

Dim strDBinfo
Dim objConnection
Dim strIsland
Dim strHotel
Dim strSelected
Dim objRS
Dim strSQL
Dim SelectedHotel
Dim rs
Dim hotelsql
Dim count
Dim i_last
Dim bgcolor

strIsland = Request.Form("Island")
strHotel = Request.Form("SelectedHotel")
strDBinfo = "DBQ=" & Server.Mappath("test2007.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};"

if not IsObject("ojbConnection") then
    set objConnection=Server.CreateObject("ADODB.Connectio n")
    objConnection.ConnectionTimeout = 15
    objConnection.CommandTimeout = 10
    objConnection.Mode = 3 'adModeReadWrite
    if objConnection.state = 0 then
        objConnection.Open strDBinfo
    end if
end if

sub makeIsland()
    if not isObject("objRS") then
        set objRS=Server.CreateObject("ADODB.RecordSet")
    end if
    if objRS.state <> 0 then
        objRS.close
    end if
    strSQL = "SELECT DISTINCT Island FROM Hawaii ORDER BY Island"
    objRS.open strSQL,objConnection,3,3
    Response.Write("<option>Start by selecting an Island here</option>" & VBCRLF )
    do while not objRS.EOF
        if objRS("Island") = strIsland then
            strSelected = " Selected "
        else
            strSelected = ""
        end if
        Response.Write("<option" & strSelected & ">" & objRS("Island") & "</option>" & VBCRLF )
        objRS.MoveNext
    loop
    objRS.Close
    set objRS=Nothing
end sub

sub makeHotel()
    if strIsland <> "" then
        if not isObject("objRS") then
            set objRS=Server.CreateObject("ADODB.RecordSet")
        end if
        if objRS.state <> 0 then
            objRS.close
        end if
        strSQL = "SELECT DISTINCT Hotel FROM Hawaii WHERE Island = '" & strIsland & "' ORDER BY Hotel"
        objRS.Open strSQL,objConnection,3,3
        if objRS.eof then
            Response.Write("<option>No Hotels found</option>")
        else
            Response.Write("<option>Select a hotel</option>" & VBCRLF )
            do while not objRS.EOF
                if objRS("Hotel") = strHotel then
                    strSelected = " Selected "
                else
                    strSelected = ""
                end if
                Response.Write("<option" & strSelected & ">" & objRS("Hotel") & "</option>" & VBCRLF )
                objRS.MoveNext
            loop
        end if
        objRS.Close
        set objRS=Nothing
    else
        Response.Write("<option></option>")
    end if
end sub

%>

<% SelectedHotel = Request.Form("SelectedHotel") %>

<SCRIPT LANGUAGE=javascript>
<!--
function submitIsland(){
    var objForm = document.forms[0];
    objForm.elements['Hotel'].selectedIndex=0;
    objForm.submit();
}

function submitForm(){
    var objForm=document.forms[0];
    objForm.submit();
    return true;
}

//-->
</SCRIPT>

</HEAD>
<BODY>
<p align="center"><h1>Hawaii Database 2007</h1></p>
<FORM action="" method=POST id=form1 name=SelectedHotel onchange="submitForm()">
<table border="0" width="100%" id="table1">
    <tr>
        <td width="132">Hawaii Island</td>
        <td> <SELECT name="Island" onChange="submitIsland()">
    <%call makeIsland%>
</SELECT></td>
    </tr>
    <tr>
        <td>Hotels</td>
        <td> <SELECT name="SelectedHotel" onChange="submitForm();">
    <%call makeHotel%>
</SELECT></td>
    </tr>
    <tr>


    </tr>
</table>
</FORM>

<%

'Set DataConn = Server.CreateObject("ADODB.Connection")

'DataConn.Open "DBQ=" & Server.Mappath("test2007.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};"

' Create a server recordset object
Set rs = Server.CreateObject("ADODB.Recordset")

' Select all data from the table and display only the selected hotel
hotelsql = "select * from Hawaii where Hotel = '" & SelectedHotel & "' ORDER BY RoomType, DateFrom"

' Execute the sql
rs.Open hotelsql, strDBinfo
%>

<div align="center">

<table BORDER="0" width="100%" height="30" bordercolor="#000000" bordercolorlight="#000000" bordercolordark="#000000" style="border-collapse: collapse" cellpadding="3" cellspacing="1">
<p align="left">
<b><% =Request.Form("SelectedHotel")%></b><br>
</p>
<tr>
<td align="center" bgcolor="#00FFCC"><b>City</b></td>
<td align="center" bgcolor="#00FFCC"><b>Stars</b></td>
<td align="center" bgcolor="#00FFCC"><b>Room Type</b></td>
<td align="center" bgcolor="#00FFCC"><b>From</b></td>
<td align="center" bgcolor="#00FFCC"><b>To</b></td>
<td align="center" bgcolor="#00FFCC"><b>Single</b></td>
<td align="center" bgcolor="#00FFCC"><b>Twin</b></td>
<td align="center" bgcolor="#00FFCC"><b>Triple</b></td>
<td align="center" bgcolor="#00FFCC"><b>Quad</b></td>
<td align="center" bgcolor="#00FFCC"><b>Child</b></td>
<td align="center" bgcolor="#00FFCC"><b>PayNts</b></td>
<td align="center" bgcolor="#00FFCC"><b>GetNts</b></td>
<td align="center" bgcolor="#00FFCC"><b>Notes</b></td>
<td align="center" bgcolor="#00FFCC"><b>Notes</b></td>

</tr>

<%
' Move to the first record
IF RS.BOF AND RS.EOF THEN
response.write "Please select a hotel first"
ELSE
rs.movefirst

' Start a loop that will end with the last record
do while not rs.eof

' Simple counter that adds one for each observation in the record set
count=count + 1

' Looks for the last digit in the count variable
i_last=right(count,1)

' If the last digit of the variable count is an odd number
' then make the background this #color
select case i_last
case "1","3","5","7","9"
bgcolor = "#EEEEDD"

' If not make the background this #color
case else
bgcolor = "#DDDDBB"
end select
%>

<tr bgcolor="<%= bgcolor%>">
<td height="6" align="center">

<%= rs("Location") %>

</td>

<td align="center" height="6">

<%= rs("Stars") %>

</td>

<td align="center" height="6">

<%= rs("Roomtype") %>

</td>

<td align="center" height="6">

<%= rs("DateFrom") %>

</td>

<td align="center" height="6">

<%= rs("DateTo") %>

</td>

<td align="center" height="6">

<%= rs("Single") %>

</td>

<td align="center" height="6">

<%= rs("Twin") %>

</td>

<td align="center" height="6">

<%= rs("Triple") %>

</td>

<td align="center" height="6">

<%= rs("Quad") %>

</td>

<td align="center" height="6">

<%= rs("Child") %>

</td>

<td align="center" height="6">

<%= rs("PayNights") %>

</td>

<td align="center" height="6">

<%= rs("GetNights") %>

</td>

<td height="6">

<%= rs("Notes1") %>

</td>

<td height="6">

<%= rs("Notes2") %>

</td>

</tr>

<%
' Move to the next record
rs.movenext
' Loop back to the do statement and end
loop
END IF
%>

</table>

</div>
<br>
<b><% =Request.Form("SelectedHotel")%></b>
</body>
</html>

<%
' Close and set the recordset to nothing
rs.close
set rs=nothing
%>
  #2 (permalink)  
Old June 4th, 2007, 10:10 AM
Registered User
 
Join Date: May 2007
Location: , CA, .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I got the error figured out. Something in the javascript was named incorrectly.

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Datalist Style in IE7 and Firefox dgatlin ASP.NET 2.0 Basics 2 April 9th, 2008 08:34 PM
Combo box choice creating filtered combo box stevensj5 Access 11 September 13th, 2007 11:33 AM
Combo box dropped down don't work proper Sneha Patel Book: Wrox's Visual C# 2005 Express Edition Starter Kit 1 May 28th, 2007 07:08 AM
Combo box can not work with dynamic Range dahlia492 Excel VBA 1 November 20th, 2006 12:43 PM
Access combo box does not work with SQL Server jerryk Access 3 July 14th, 2006 03:30 PM



All times are GMT -4. The time now is 01:49 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.