I have a form with 2 selects : Regions and Cities.
The Cities selects is created dynamically according to the region. It is populated by calling a separate asp page through AJAX which replaces the entire cities select.
After I submit the form everything works fine in IE , but in Firefox there is not any value received in the next page
from the Cities select. In other words firefox doesnt recognize the select box which is added to the page after the page has loaded.
Any help will be truly appreciated
This is my code:
<form method="get" action="searchResults.asp"
name="searchForm">
<select name="region" onchange="htmlData('cities
.asp','Reg
ionId='+th
is.value+'
&objName=C
ity','spCi
ty')" >
<option value="all">ÛÜ ÐÙÖÕè</option>
<%
While (NOT rsRegion.EOF)
%><option value="<%=(rsRegion.Fields
.Item("id"
).Value)%>
" <%if request.queryString("regio
n") = CStr(rsRegion.Fields.Item(
"id").Valu
e) then%>selected<%end if%>><%=(rsRegion.Fields.I
tem("name_
heb").Valu
e)%></opti
on>
<%
rsRegion.MoveNext()
Wend
If (rsRegion.CursorType > 0) Then
rsRegion.MoveFirst
Else
rsRegion.Requery
End If
%>
</select>  
;
<span id="spCity">
<select id="City" name="City" DefaultText=" ÛÜ ÙéÕÑ " dir="rtl" ><option value="all">ÛÜ ÙéÕÑ</option></select>
</span>
</form>
<script language="javascript">
function GetXmlHttpObject(handler)
{
var objXMLHttp=null
if (window.XMLHttpRequest) {
objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject) {
objXMLHttp=new ActiveXObject("Microsoft.X
MLHTTP")
}
return objXMLHttp
}
function stateChanged(){
if (xmlHttp.readyState==4 || xmlHttp.readyState=="compl
ete")
{
//alert(divname1);
document.getElementById(di
vname1).in
nerHTML= xmlHttp.responseText;
}
}
// Will populate data based on input
var divname1
function htmlData(url, qStr,divname){
divname1 = divname;
if (url.length==0) {
document.getElementById(di
vname).inn
erHTML="";
return; }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null){
alert ("Browser does not support HTTP Request");
return; }
url=url+"?"+qStr;
url=url+"&sid="+Math.rando
m();
xmlHttp.onreadystatechange
=stateChan
ged;
xmlHttp.open("GET",url,tru
e) ;
xmlHttp.send(null);
}
</script>
------------------- Code for Cities.asp ------------
<%
Dim rsCity
Dim rsCity_cmd
Dim rsCity_numRows
numRecs = 1
currPage = 1
Set rsCity_cmd = Server.CreateObject ("ADODB.Command")
rsCity_cmd.ActiveConnectio
n = MM_connSite_STRING
SQL="SELECT id as vId , CityName as vCityName FROM cities "
SQL= SQL & " WHERE RegionId = " & Request("RegionId")
SQL= SQL & " ORDER BY CityName"
rsCity_cmd.CommandText = SQL
rsCity_cmd.Prepared = true
Set rsCity = rsCity_cmd.Execute
if not rsCity.eof then
%>
<select name="<%=request("objName"
)%>">
<option value="all" selected="selected">ÛÜ ÙéÕÑ</option>
<% While (NOT rsCity.EOF)%>
<option value="<%=(rsCity.Fields.I
tem("vid")
.Value)%>"
<%if request("vdefault") = CStr(rsCity.Fields.Item("v
id").Value
) then%> selected<%End if%>><%=(rsCity.Fields.Ite
m("vCityNa
me").Value
)%></optio
n>
<%
rsCity.MoveNext()
Wend
%>
</select>
<%end if%>
<%
rsCity.Close()
Set rsCity = Nothing
%>
Start Free Trial