Thank you for putting me in this direction.<br>I get an error with your suggested code. <span class="objectBox objectBox-errorMessage hasTwisty hasBreakSwitch "><div class="errorTitle focusRow subLogRow "><span class="errorMessage ">missing ; before statement</span></div>
<div class="errorTrace "></div><span class=" "></span><div class="errorSourceBox errorSource-syntax focusRow subLogRow "><table class=" " cellpadding="0" cellspacing="0"><tbody class=" "><tr class=" "><td class=" "><br></td>
<td class=" "><a class="errorSource a11yFocus "><pre title="var filter_param["cql_filter"] = "norsknavngruppe LIKE '%Sopp%';" class="errorSourceCode ">var filter_param["cql_filter"] = "norsknavngruppe LIKE '%Sopp%';</pre>
<pre title="var filter_param["cql_filter"] = "norsknavngruppe LIKE '%Sopp%';" class="errorSourceCode "><span class="Apple-style-span" style="font-family:arial;white-space:normal">So I tried this:</span></pre>
</a></td></tr></tbody></table></div></span><div><br> <b>var filter_param = "norsknavngruppe LIKE '%Sopp%'";</b><br> info = new OpenLayers.Control.WMSGetFeatureInfo({<br> url: '<a href="http://kart.naturkart.no/geoserver/wms">http://kart.naturkart.no/geoserver/wms</a>',<br>
title: 'Identify features by clicking',<br> queryVisible: true,<br> infoFormat:'application/vnd.ogc.gml',<br> <b>vendorParams:{<br>
filter_param:filter_param<br> },</b><br> eventListeners: {<br> getfeatureinfo: function(event) {<br> if (popup) {<br>
map.removePopup(popup);<br> } .........<div><br></div><div>I get no error and I see (in Firebug) that this is added to the WMS request:</div><div><code class="focusRow subFocusRow ">&info_format=application%2Fvnd.ogc.gml&filter_param=norsknavngruppe%20LIKE%20'%25Sopp%25'</code><br>
<br></div><div>Still I get no filtering of the popups and it shows any data that is in the clicked location. I see that the response contains i.ex.</div><div><gbif_ns:norsknavngruppe>Lav</gbif_ns:norsknavngruppe></div>
<div>and it should not be included since I only want "norsknavngruppe LIKE '%Sopp%". </div><div>Is there something wrong with my code? Thanks for any suggestions!</div><div><br><br>2012/6/8 Ignacio Talavera <<a href="mailto:ignacio.talavera@gmail.com">ignacio.talavera@gmail.com</a>>:<br>
> Hi the WMSGetFeatureInfo manage additionals parameters of the url of the<br>> GetFeatureInfo Request in vendorparams attribute.<br>> So try to add this to your code<br>><br>> var filter_param["cql_filter"] = prosjektnummer LIKE '%2008-25%' OR<br>
> prosjektnavn LIKE '%2008-25%<br>> info = new OpenLayers.Control.WMSGetFeatureInfo({<br>> url: '<a href="http://kart.naturkart.no/geoserver/wms">http://kart.naturkart.no/geoserver/wms</a>',<br>
> title: 'Identify features by clicking',<br>> queryVisible: true,<br>> infoFormat:'application/vnd.ogc.gml',<br>> vendorParams:filter_param<br>
> eventListeners: {<br>> getfeatureinfo: function(event) {<br>> if (popup) {<br>> map.removePopup(popup);<br>> } ........................<br>
> I hope this is useful to you.<br>> Regards<br>> Nacho<br>> On Thu, Jun 7, 2012 at 11:48 AM, Asle Benoni <<a href="mailto:asle.benoni@gmail.com">asle.benoni@gmail.com</a>> wrote:<br>>><br>>> I have made this map: <a href="http://www.babkart.no">www.babkart.no</a><br>
>><br>>> I have a search box that on select of the results sends a refresh of<br>>> the layer with CQL parameters to GeoServer. This works.<br>>> But of course when I click I get popups of all the markers, even if<br>
>> they are hidden because I understand that I send a WMS request without<br>>> any filter.<br>>><br>>> So I need help how to use the generated CQL params in my WMS request<br>>> for GetFeautureInfo to GeoServer.<br>
>><br>>> My function CQLfilter in app.js on line 1027 produces this link:<br>>> prosjektnummer LIKE '%2008-25%' OR prosjektnavn LIKE '%2008-25%<br>>> which I use to filter the map.<br>>><br>
>> The question is how I can use this (or IF I can use it!) in my<br>>> function (line 907):<br>>><br>>> info = new OpenLayers.Control.WMSGetFeatureInfo({<br>>> url: '<a href="http://kart.naturkart.no/geoserver/wms">http://kart.naturkart.no/geoserver/wms</a>',<br>
>> title: 'Identify features by clicking',<br>>> queryVisible: true,<br>>> infoFormat:'application/vnd.ogc.gml',<br>>> eventListeners: {<br>
>> getfeatureinfo: function(event) {<br>>> if (popup) {<br>>> map.removePopup(popup);<br>>> } ........................<br>
>><br>>> Any ideas on how to use the CQL code here?<br>>><br>>> ~asle<br>>> _______________________________________________<br>>> Users mailing list<br>>> <a href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a><br>
>> <a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br>><br>><br><br></div></div>