I've a Search widget on my map. What I'm trying to do is when a user types, let's say, 1215 Bourboun St, I want to append Sacramento, US to that value so that very precised results are returned back.
I've looked at the documentation and found a search-results event, which basically lets me play around with the returned results. But is there an event which I can subscribe to which takes place just before a search is done? This will enable me to modify the search value before initiating a search.
My code is as follows:
map = new Map("mapDiv", {
center: [xyz, abc],
zoom: 10,
basemap: "streets"
});
var search = new Search({
map: map
}, dom.byId("search"));
search.startup();
search.on("search-results", populateHiddenField);
.
.
.
// some irrelevant code
UPDATE
Using Gary's suggestion, I created a fiddle to let you experts help me out on this one.
Case Scenario:: If you start typing 1215, you'll notice that it returns result from all over the world and not just Sacramento even though I've extended the Search class per Gary's suggestion. Is there a way that I can restrict the autosuggestions to Sacramento alone?