MaikHassel


Hello!


I need to use a custom "search where" input field in my VE based application. I would like to add the same "life search address suggestions" one can see on http://maps.live.com/.


I tried to use map.find for this, which works, but it pops up an error box on the map when the location is not found ("The closest match is....").


So I need the option to either query the location without using the "map" object or prevent the error box from popping up.


Any suggestions or examples Unfortunately the life search API doesn't provide address searches....


Thanks!

Maik




Re: Address suggestions on custom input field

SoulSolutions


FYI you can query the search independantly:

http://www.viavirtualearth.com/wiki/UseLiveSearch.ashx

But I think you need to look at the callback function of the map.find() method. From here you can display the possible results and let the user choose in your custom interface.

The iSDK has a good example (find information advanced):

http://dev.live.com/virtualearth/sdk/

John.







Re: Address suggestions on custom input field

MaikHassel

Hmmm, would using the callback function disable the error box If I call map.find on a string like "b", I currently get an empty resultset returned and an error box pops up in the map saying "the closes match is...". If I use my own callback function to for example populate a dopdown list with suggestions, would that disable the error box





Re: Address suggestions on custom input field

Derek Chan

You can definately disable the disambiguation box and fire up your own "suggestion" box. When you make your map.Find call you can pass in "false" to the "useDefaultDisambiguation" parameter. Then in your callback function (specified in your map.Find "callback" parameter) , you can check to see the number of results in the VEFindResult class array. If it has more than one result, then fire up your suggestion box.

You can see everything in more detail here:
http://msdn2.microsoft.com/en-us/library/bb429645(d=ide).aspx

Hope that helps,






Re: Address suggestions on custom input field

MaikHassel


Ok, there is some confusion here, sorry for being ambiguous:

The disambiguation box can be switched off, I realize that. What I am NOT able to switch off is the error box that appears on the map when no result can be found! Even with disambiguation box switched off, map.find("b") will show an error message box on the screen saying "The closest match for 'b' is..... If this is not what you...." THIS error box is what I need to get rid off.

With "suggestion box" I was incorrectly referring to ajax-ified input field suggestions ("auto-complete") I want to have appear on the "search where field" while the user types...

So the question remains: How can I switch off the error box




Re: Address suggestions on custom input field

Tristan Burch

I ended up using CSS to get rid of that error box.




Re: Address suggestions on custom input field

illumiCoder

I am currently working on a similar problem where I wish to completely get rid of the error box that appears

when I make call to Map.Find().... Can you be more specific has to the exact css class names / id's and/or properties you changed to disable this dialog box I'm assuming you set its visibility: hidden and/or display: none.......





Re: Address suggestions on custom input field

Derrick

you can prevent all error messages from appearing by overwrite the VEMap.ShowMessage(msg) function.

Code Snippet

var errorMessage = null;

VEMap.ShowMessage = function(msg)

{

//Using the ShowMessage to trap errors and do not show the error message

errorMessage = msg;

}