I have code like so

        var sLyr = new OpenLayers.Layer.Vector("s");
        map.addLayers([sLyr]);
        
        var polyCtrl = new OpenLayers.Control.DrawFeature(
                sLyr,
            OpenLayers.Handler.Polygon,
            {featureAdded: foo}
        );
        
        function foo(evt){
            var elem = document.getElementById(evt.feature.geometry.id);
        
            // do something with elem
        }
        
        map.addControl(polyCtrl);
        polyCtrl.activate();
        
I get an error: "TypeError: 'undefined' is not an object (evaluating 
'evt.feature.geometry')"

So, foo() is getting fired alright. What is my error above, and how do I solve 
it? Essentially, I want to access the id of the polygon just created.


--
Puneet Kishor_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to