@Silvia Rebelo try:
$('input[type=search]').on('search', function () {
console.log("clear clicked");
});
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I'm using the Microsoft.Maps.AutoSuggest
module on my app and it's working great, however, I'm in the need of validating that the user has entered a value in order to continue. Imaging this scenario:
1) user searches for a location in the UI
2) selects one from the list (I save this in a state variable)
3) the user "clears" the selection clicking the "x" icon (I need to clear the state here)
I've been reading the documentation and I can't find a callback for that clear event.
I tried to programatically clearing the state variable with an onChange
function in the input, but I'm introducing an error and I'm just hoping there is a way to do this with the module callbacks?
window.Microsoft.Maps.loadModule('Microsoft.Maps.AutoSuggest', {
callback: onLoad,
errorCallback: onError,
clearCallback: onClear // <----- something like this?
});
Any idea how this could be achieved? Thanks in advance!
@Silvia Rebelo try:
$('input[type=search]').on('search', function () {
console.log("clear clicked");
});
Hi @Silvia Rebelo ,
We have an AutoSuggest without UI sample available here https://learn.microsoft.com/en-us/bingmaps/v8-web-control/map-control-concepts/autosuggest-module-examples/filling-in-an-address-form-example and a live interactive sample here https://www.bing.com/api/maps/sdkrelease/mapcontrol/isdk/autosuggestuiwithoutmap
The documentation does not have an "onClear" as noted here: https://learn.microsoft.com/en-us/bingmaps/v8-web-control/map-control-api/moduleoptions-object
Sincerely,
IoTGirl