GeoSearch.Init Tutorial
Integrating with External GUI
If you are integrating GeoSearch into an existing web site, you might already have a search box in your page which you would like to use to trigger GeoSearches.
To instruct GeoSearch to use an external search form, you must pass in two parameters to the GeoSearch.Init() options:
- searchFormId - The "id" field of the form containing the input field
- searchFieldName - The "name" field of the input
So, if your existing search field's HTML code looks like this:
<form id="searchForm">
<input type="input" name="searchField"/>
<input type="submit" value="Search"/>
</form>
...then you would pass the following values to the Init() function:
MetaCarta.GeoSearch.Init({'textDivId': 'list',
'mapDivId': 'map',
'searchFormId': 'searchForm',
'searchFieldName': 'searchField'});
To see this in action, load this example.
Previous: Integrating with External GUI |Next: Run Initial Query from URL