Autocomplete Address Validation

Thanks @yisrael-wix

Is the onchange function the ideal scenario in this case, or the onReady function?

Essentially I want the error message to pop up when they try to click the Submit button. I guess onChange() does it when they click out of the address field right?
I’m happy with that as long as I can get an error message similar to the picture below

$w.onReady(function () {
      let addressLocation = $w("#addressInput1").value.location;
      addressLocation.onCustomValidation( (value, reject) => {
        if( value === 'undefined') ) {
          reject("Address has been incorrectly entered. Please pick from the list");
     }
      } );
    });

exportfunctionaddressInput1_change(event){letaddress=$w("#addressInput1").value;console.log('change address',address);}


The above is what I tried so far. As far as I can tell if they enter it incorrectly, the location property would show as ‘undefined’. However I’m not sure how to use the onCustomValidation on a property. I can see it’s meant to be tested on the elementID, but I only want to validate to check if the address.location property is undefined, and if so return an error message.

Is there a way to get around this?

If it isn’t painfully obvious, it’s been years since I worked with Javascript and when I did it was only for a year, so extremely rusty with it.

@Bruno Prado I gave this a try, but nothing was happening when I was typing the input in. I’m assuming I need to enter code in between this function?

export function addressInput1_blur(event) {
    
}