[ka-Map-users] Customizing search system
Alessio Di Lorenzo
alessio.dilorenzo at gmail.com
Thu Mar 20 09:11:32 EDT 2008
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
--
View this message in context: http://www.nabble.com/Customizing-search-system-tp14935121p16177886.html
Sent from the ka-map-users mailing list archive at Nabble.com.
More information about the ka-Map-users
mailing list