[ka-Map-users] Customizing search system

Alessio Di Lorenzo alessio.dilorenzo at gmail.com
Sat Mar 22 10:50:07 EDT 2008


Hi guys,

problem solved!
In the next days I will tell you how with pleasure

for now... have a good Easter!

alessio ;)

PS
I hope this feature will be inserted in the next version of ka-map.



Alessio Di Lorenzo ha scritto:
> Hi,
>
> After a period of working on other things, I started again to work on a
> search filter in ka-map.
> My objective is to queryByAttributes only a specifical postgis table (or
> shape), 
> selected by the user through an appropriate interface, instead the entire
> database.
>
> So, I modified the kaSearch.php by substituting the following For cicle:
>
> for ($i = 0; $i < $tot; $i++) {
> 	$oLayer = $oMap->getLayer($i);
> ...
> ..
> }
>
> with the following code:
>
> $layer = $_REQUEST['searchlayer'];
>
> $oLayer = $oMap->getLayerByName($layer);
>
> where 'searchlayer' represents the "name" parameter in a dropdown list that
> I inserted
> in the search form in my index.html:
>
> <form name="search"
> action="javascript:myKaSearch.search(document.forms['search'].elements['searchstring'].value);">
>
> 	<select name="searchlayer">
> 		<option value="nome_tabella_1">Alias1</option>
> 		<option value="nome_tabella_2">Alias2</option>
> 		<option value="nome_tabella_3">Alias3</option>
> 	</select>
>
> <input type="text"...>
> <button type="button"
> onClick="myKaSearch.search(document.forms['search'].elements['searchstring'].value)">Cerca</button>
> </form>
>
> I suppose that the mapscript code hack is correct.
> Infact, if I type manually the table name as an argument of the
> getLayerByName() method
> it works. Otherwise, when I use the $layer variable as an argument of the
> same method, it doesn't work.
>
> Example:
>
> $oLayer = $oMap -> getLayerByName('my_table_name')  --> works fine 
>
> $oLayer = $oMap -> getLayerByName($layer)  --> doesn't work
>
>
> The problem is that the value that I want to send from the <select
> name="searchlayer">
> is not sent to the kaSearch.php file.
>
> I suppose I need to modify the onClick in the html and/or the kaSearch.js in
> some way, 
> but I'm not an expert in ajax/javascript, so I need some help in this issue.
>
> Thx all in advance
>
> alessio 
>
>   



More information about the ka-Map-users mailing list