PLEASE NOTE: This script is provided to help you get started. Unfortunately, our free support does not include custom scripts. Any competent JS developer should be able to manipulate this script for your needs. Please contact us if you need help to find a developer. Please thoroughly test before use.

  • When using real time address verification sometimes Google allows addresses through without a house number, street address, or post code.
  • To address this we provide a script to ensure a user cannot proceed to the next node unless the address is valid.

In a question node of type “address”, setup a node level script to look like this:

Then copy paste the following code:

  var interval = setInterval(nodeLoaded, 500);
  // Check if node is loaded
  function nodeLoaded() {
    var button = document.querySelector('#forward-button');
    var input = document.querySelector('.form-control');
    // If the button and input are not null, they are in the DOM
    if (button && input) {
      console.log("Button and input are loaded!");

      //attach the event listener
      button.addEventListener("click", function(event){
        //get input value ( address )  
        var val = input.value;
        //check if address contains any digits (street numbers)";
        var matches = val.match(/\d+/g);
        if (matches != null) {
            console.log(val + " submitted!");

            // If Angular is available in your environment
                // Get the Angular scope
                var scope = angular.element(document.querySelector('.app')).scope();

                // If the scope and next function are available
                if(scope && typeof === "function"){
                    // Use Angular's digest cycle to update the view
        } else {
            console.log(val + " rejected!");
            alert("You must enter a Valid Complete address");          
            //prevent submission of button
            return false;

      // Clear Interval Function when button and input are loaded

You can see a demo of this here:

( Try entering a city name, eg: “Sydney”. It wont let you submit the address as it contains no street number )