roadidPicker = new OpenLayers.Control.WMSGetFeatureInfo({
url: 'http://www.domainname.com:8080/geoserver/wms',
title: 'identify features on click',
layers: [wms],
queryVisible: true
});
roadidPicker.infoFormat = 'application/vnd.ogc.gml';
roadidPicker.events.register("getfeatureinfo", this, pickRoadid);
map.addControl(roadidPicker);
roadidPicker.activate();
function pickRoadid(e) {
if (e.features && e.features.length) {
var val = e.features[0].attributes.id;
document.getElementById('roadId').value = val;
}
}
I used this code for fetching values from dbf file. I got 0 value for e.features.length.So i can't display information on map using onclick event.