[OpenLayers-Users] map scope problem

S.Reena reena at indiamail.com
Thu Oct 23 03:20:39 EDT 2008


Hi ,

I  changed my code to use OpenLayers.LoadURL function like this

 OpenLayers.loadURL("reports1.html", '', this,afterreports)

In this reports.html file, I've made some dependent drop down boxes where
content of 2nd option box depends on selection made in 1st option box etc.
Also I am calling a php file which modifies the database in
 el.innerHTML="<iframe src=\"showtable.php\"+queryString height=100%
width=100% ></iframe>" 

Now the thing is that in afterreports function if I place the
response.responseText in a div , then 
the option boxes don't work properly but wms[8].setVisibility(true) works.
On alert(wms) it gives [object Object],[object Object], etc.


But if I make a OpenLayers popup and show response.responseText in that, the
option boxes work properly but wms[8].setVisibility(true) doesn't work and
alert(wms) gives ,,,,,,, etc.


What can be reason for this?

Thanks
Reean.



Pierre GIRAUD wrote:
> 
> First, I don't think we're able to find your scope problem if you
> don't provide more code.
> 
> In the mean time, I wonder why you are using your own XmlHttp requests
> handler. There are ready to use classes in OpenLayers that can help
> you writing AJAX code.
> Please have a look at the AJAX class and at the OpenLayers.loadURL
> method. This should help you.
> 
> If you still have problems with scopes, come back to us with more code.
> 
> Regards,
> Pierre
> 
> On Wed, Oct 22, 2008 at 7:52 AM, S.Reena <reena at indiamail.com> wrote:
>>
>> I have used AJAX to load a php file "showmap.php" which makes a database
>> table based on selections . I have used that table to create a layer in
>> init() function itself which makes the map and rendered it false there
>> using
>> wms[8].setVisibility(false). I want that  in openmap() function I just
>> make
>> that layer visible...but all the functions called after that php file is
>> executed takes map ,vector,wms etc as undefined. How to deal with this?
>>
>>  function showmap(queryString)
>>        {
>>
>>          var xmlHTTP;
>>          xmlHTTP=GetXmlHttpObject();
>>
>>          if (xmlHTTP==null)
>>          {
>>              alert ("Your browser does not support AJAX!");
>>              return;
>>          }
>>          xmlHTTP.onreadystatechange=function()
>>          {
>>             if((xmlHTTP.readyState==4) ||
>> (xmlHTTP.readyState=="complete"))
>>             {
>>                var res=xmlHTTP.responseText;
>>                if(res==0)
>>                {
>>                        openmap();
>>                }
>>             }
>>          }
>>         // alert(queryString);
>>          xmlHTTP.open("GET", "showmap.php"+queryString, true);
>>          xmlHTTP.send(null);
>>
>>        }
>>
>> --
>> View this message in context:
>> http://www.nabble.com/map-scope-problem-tp20104382p20104382.html
>> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> 

-- 
View this message in context: http://www.nabble.com/map-scope-problem-tp20104382p20125622.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list