|
Subject:
|
Ajax error on FireFox when pass value to next page
|
|
Posted By:
|
lvb
|
Post Date:
|
9/27/2006 10:44:55 AM
|
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.
|
|
Reply By:
|
lvb
|
Reply Date:
|
9/27/2006 11:35:49 AM
|
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); } }
|
|
Reply By:
|
joefawcett
|
Reply Date:
|
9/28/2006 2:37:47 AM
|
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)
|
|
Reply By:
|
lvb
|
Reply Date:
|
9/28/2006 9:22:48 AM
|
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: </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: </td> <td><select name="appointment_date" id="appointment_date" onchange="showTime(document.apptform.select_employee.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: </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.
|