Advertisement

01.09.2008 at 02:35AM PST, ID: 23068962
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

5.4

firefox not passing values from form select box dynamically created with AJAX

Asked by dog_star in JavaScript, Active Server Pages (ASP), Firefox Web Browser

Tags:

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','RegionId='+this.value+'&objName=City','spCity')" >
         
                                                                <option value="all">ÛÜ ÐÙÖÕè</option>
                       
                        <%
                                                                                                While (NOT rsRegion.EOF)
                                                                                                %><option value="<%=(rsRegion.Fields.Item("id").Value)%>" <%if request.queryString("region") = CStr(rsRegion.Fields.Item("id").Value) then%>selected<%end if%>><%=(rsRegion.Fields.Item("name_heb").Value)%></option>
                                                                                                                                  <%
                                                                                                  rsRegion.MoveNext()
                                                                                                Wend
                                                                                                If (rsRegion.CursorType > 0) Then
                                                                                                  rsRegion.MoveFirst
                                                                                                Else
                                                                                                  rsRegion.Requery
                                                                                                End If
                                                                                                %>
                       
                       
                       
                        </select>&nbsp;&nbsp;&nbsp;
                       
                         <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.XMLHTTP")  
                                                   }    
                                                   return objXMLHttp
                   }
                   function stateChanged(){
                      if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")    
                                  {
                                  //alert(divname1);
                                  document.getElementById(divname1).innerHTML= xmlHttp.responseText;
                                 

 }
                                 
                                  }
               
                // Will populate data based on input
                var divname1
                function htmlData(url, qStr,divname){
                divname1 =  divname;
               
                  if (url.length==0) {
                                document.getElementById(divname).innerHTML="";
                                return; }
                 xmlHttp=GetXmlHttpObject()    
                 if (xmlHttp==null){
                         alert ("Browser does not support HTTP Request");        
                                                 return;    }    
                 url=url+"?"+qStr;    
                 url=url+"&sid="+Math.random();    
                 xmlHttp.onreadystatechange=stateChanged;    
                 xmlHttp.open("GET",url,true) ;    
                 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.ActiveConnection = 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.Item("vid").Value)%>" <%if request("vdefault") = CStr(rsCity.Fields.Item("vid").Value) then%> selected<%End if%>><%=(rsCity.Fields.Item("vCityName").Value)%></option>
     
      <%
                                                 rsCity.MoveNext()
                                                                                                Wend
                  %>  
        </select>
                <%end if%>
<%
rsCity.Close()
Set rsCity = Nothing
%>

Start Free Trial
[+][-]01.10.2008 at 01:01AM PST, ID: 20625824

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: JavaScript, Active Server Pages (ASP), Firefox Web Browser
Tags: asp
Sign Up Now!
Solution Provided By: dog_star
Participating Experts: 1
Solution Grade: B
 
 
[+][-]01.10.2008 at 01:48AM PST, ID: 20626019

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]01.10.2008 at 09:26AM PST, ID: 20629028

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628