question

SilviaRebelo-1366 avatar image
1 Vote"
SilviaRebelo-1366 asked ·

Autosuggest UI (without map) on clear callback

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!

windows-maps
· 2
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @SilviaRebelo-1366 Welcome to Microsoft Q&A Platform and thanks for your query. Community SME's on this topic or our team will review your scenario and circle back at the possible earliest time.

1 Vote 1 ·

Hello @SilviaRebelo-1366 sorry for the delay, I am working with my team on this.

1 Vote 1 ·
IoTGirl avatar image
1 Vote"
IoTGirl answered ·
·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

lenrok avatar image
1 Vote"
lenrok answered ·

@SilviaRebelo-1366 try:

 $('input[type=search]').on('search', function () {
     console.log("clear clicked");
 });
·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.