Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > BOOK: Professional Ajax ISBN: 978-0-471-77778-6
|
BOOK: Professional Ajax ISBN: 978-0-471-77778-6
This is the forum to discuss the Wrox book Professional Ajax by Nicholas C. Zakas, Jeremy McPeak, Joe Fawcett; ISBN: 9780471777786
Important: For the new 2nd edition of this book, please post here instead: [url="http://p2p.wrox.com/forum.asp?FORUM_ID=307"]http://p2p.wrox.com/forum.asp?FORUM_ID=307[/url]
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Ajax ISBN: 978-0-471-77778-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 27th, 2006, 10:44 AM
lvb lvb is offline
Registered User
 
Join Date: Sep 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ajax error on FireFox when pass value to next page

Hello,
I am using Ajax to populate a selectbox and then pass the value to the next page. It works just fine on IE. On FIREFOX, it gives error saying 'form.thevalue' undefined. Does anybody know why?

Thanks in advance.

 
Old September 27th, 2006, 11:35 AM
lvb lvb is offline
Registered User
 
Join Date: Sep 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Just a thought that you might want to see the Ajax function:

var xmlHttp = false;
try {
xmlHttp = new XMLHttpRequest();
} catch (trymicrosoft) {
    try {
     xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (othermicrosoft) {
        try {
         xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (failed) {
            xmlHttp = false;
        }
    }
}

if (!xmlHttp) {
alert("Error initializing XMLHttpRequest!");
}

function showTime(staff, date, available) {
var url="/cf/misc/GetTime.cfm?nicknm=" + staff + "&dt=" + date + "&ti=" + available
xmlHttp.open("GET", url, true);
xmlHttp.onreadystatechange = updatePage;
xmlHttp.send(null);
}

function updatePage() {
if (xmlHttp.readyState == 4) {
    if (xmlHttp.status == 200) {
     var response = xmlHttp.responseText;
     document.getElementById("timelist").innerHTML = response;
    }
    else
     alert("status is " + xmlHttp.status);
}
}
 
Old September 28th, 2006, 02:37 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

It would be better to show the code where form.value is used. Mozilla is stricter about accessing elements than IE. Show the HTML of the input element whose value you are trying to access.

--

Joe (Microsoft MVP - XML)
 
Old September 28th, 2006, 09:22 AM
lvb lvb is offline
Registered User
 
Join Date: Sep 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you Joe for replying.
I am using ColdFusion. Here's part of the form.cfm and GetTime.cfm:

form.cfm
<tr><td align=right nowrap="nowrap"><b>Signature Staff: &nbsp;</td>
    <td><select name="select_employee" id="select_employee" onchange="showTime(this.value,
         document.apptform.appointment_date.value, '');">
     <option value="All">All</option>
     <cfloop query = "GetEmployees">
            <cfif GetEmployees.EMPLOYEE_ID eq '#chg_select_employee#'>
             <cfset select = "SELECTED">
            <cfelse>
             <cfset select = "">
            </cfif>
            <cfoutput><option value="#GetEmployees.EMPLOYEE_ID#"
             #select#>#GetEmployees.NICK_NAME#</option></cfoutput>
         </cfloop>
        </select></td>
    <td align=right><b>Select Date: &nbsp;</td>
    <td><select name="appointment_date" id="appointment_date"
    onchange="showTime(document.apptform.select_employ ee.value, this.value, '');">
    <option value=''>[Select]</option>
        <cfloop list="#datelist#" index="thedate">
     <cfif thedate eq '#chg_appointment_date#'>
        <cfset select='SELECTED'>
     <cfelse>
        <cfset select=''>
     </cfif>
         <cfoutput><option value="#thedate#" #select#>#thedate#</option></cfoutput>
        </cfloop>
     </select></td>
</tr>
<tr><td align=right valign=top><b>Available Time: &nbsp;</td>
    <td valign=top><span id="TimeList">
     <select name="available_time">
        <option value=""></option>
     </select></span></td>


GetTime.cfm
<CFINCLUDE TEMPLATE="include.cfm">
<cfset timelist = arrayToList(structSort(atime, "numeric"))>
<cfset timelist1 = arrayToList(structSort(atime1, "numeric"))>

<span>
<select name="available_time">

<cfif trim(URL.nicknm) eq 'All'>
<option value=''>[Select]</option>
<cfloop list='#timelist#' index='time'>
     <cfif time EQ '#trim(url.ti)#'>
    <cfset select = 'SELECTED'>
     <cfelse>
        <cfset select = ''>
     </cfif>
    <cfoutput><option value="#atime[time]#" #select#>#time#</option></cfoutput>
</cfloop>
<cfelse>
<cfquery name="getEmployee" datasource="signatu_datasource" cachedwithin="#createTimeSpan(0,0,0,-1)#">
    select * from SIGNATU_APPOINTMENT
    where EMPLOYEE_ID = "#trim(URL.nicknm)#"
    and DATE = "#trim(URL.dt)#"
</cfquery>

<cfset tempTimeList = ValueList(getEmployee.TIME)>
<cfif getEmployee.RecordCount GT 0>
<option value=''>[Select]</option>
<cfloop list="#tempTimeList#" index="theTime">
     <cfloop list='#timelist1#' index='current_time'>
     <cfif current_time eq '#theTime#'>
         <cfset d = StructDelete(atime1, "#current_time#", "True")>
     </cfif>
     </cfloop>
</cfloop>

<cfset timelist2 = arrayToList(structSort(atime1, "numeric"))>
<cfloop list='#timelist2#' index='time2'>
     <cfif time2 EQ '#trim(url.ti)#'>
     <cfset select = 'SELECTED'>
     <cfelse>
         <cfset select = ''>
     </cfif>
     <cfoutput><option value="#atime1[time2]#" #select#>#time2#</option></cfoutput>
</cfloop>
<cfelse>
<option value=''>[Select]</option>
<cfloop list='#timelist1#' index='curr_time'>
     <cfif curr_time EQ '#trim(url.ti)#'>
     <cfset select = 'SELECTED'>
     <cfelse>
         <cfset select = ''>
     </cfif>
     <cfoutput><option value="#atime1[curr_time]#" #select#>#curr_time#</option></cfoutput>
</cfloop>
</cfif>
</cfif>
</select>
</span>

When I pass #form.available_time# to the next page, I got error on FireFox, 'form.available_time' undefined.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with AJAX in Firefox geoko BOOK: Professional Ajax ISBN: 978-0-471-77778-6 2 June 27th, 2009 11:57 AM
Page Expire code not working in firefox nrlahoti ASP.NET 2.0 Professional 1 May 15th, 2009 07:21 AM
AJAX in firefox anandham Ajax 0 July 27th, 2006 05:18 AM
How to pass variables from Aspx page to Asp Page jayaraj Classic ASP Basics 2 May 23rd, 2004 06:56 AM
How to pass the variables in Aspx page to Asp Page jayaraj ASP.NET 1.0 and 1.1 Basics 3 May 23rd, 2004 06:55 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.