I am having a problem with getting the layer name. When I run the code I get an error "Cannot read property 'features' of undefined", obviously because it is not getting the layer name.
.....html...... <form name="myform" action="" method="GET"> <input type="hidden" name="layer" value="mh_layer"> <input TYPE="button" NAME="button" Value="Search" onClick="searchTest(this.form)"> </form> ....html..... function searchTest () { layer = map.getLayersByName(form.layer.value)[0]; searchVector(layer,keyword); } var map, select; function init(){ map = new OpenLayers.Map('map', { units: 'm', numZoomLevels: 19, projection: epsg900913, displayProjection: epsg4326 //Is used for displaying coordinates in appropriate CRS by MousePosition control }); var mh_layer = new OpenLayers.Layer.Vector("Manhole", { searchfields: [ 'STRUCT_ID', 'OWNER_NAME', 'GPS_DATE' ], titlefield: 'STRUCT_ID', strategies: [new OpenLayers.Strategy.Fixed()], protocol: new OpenLayers.Protocol.HTTP({ url: "./mh.geojson", format: new OpenLayers.Format.GeoJSON({ extractStyles: true, extractAttributes: true }) }) }); -- View this message in context: http://osgeo-org.1560.n6.nabble.com/What-is-the-easiest-way-to-search-a-vector-layer-s-tp5036948p5037574.html Sent from the OpenLayers Users mailing list archive at Nabble.com. _______________________________________________ Users mailing list us...@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/openlayers-users