[OpenLayers-Users] Error in getfeature info

Phil Scadden p.scadden at gns.cri.nz
Mon Feb 25 12:02:47 PST 2013


> function pickRoadid(event) {
> 	popupClear();
>    if (event.features && event.features.length) {
>    alert("hi");
>       var val = event.features[0].attributes.id;
>       document.getElementById('fid').value = val;
>    }
> }
>
> But its returning me an error
> Cannot set property 'value' of null .
So pickRoadid is being called. Use firebug or similar debugger to set a 
breakpoint at var val = ....
and examine what you are actually getting in features. More likely 
however the problem is with the DOM. Whatever beast is identified by 
'fid' may not have a data value. Evaluate document.getElementById('fid') 
and see whether it is what you expect.

Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.



More information about the Users mailing list