Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="container">
  <!-- header -->
  <nav class="navbar navbar-expand-lg navbar-light bg-light">
    <div class="container-fluid">
      <a class="navbar-brand" href="#">
        <img src="https://www.loqate.com/content/images/loqate_logo_dark.svg" style="height: 50px">
      </a>
      <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
      </button>
      <div class="collapse navbar-collapse" id="navbarSupportedContent">

        <div class="navbar-nav me-auto mb-2 mb-lg-0">

          <span class="navbar-text">
            <h4>Business API Demo - Loqate ANZ</h4>
          </span>
        </div>

        <div class="navbar-nav ms-auto mb-2 mb-lg-0">

          <div class="nav-item dropdown">
            <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-bs-toggle="dropdown" aria-expanded="false">
              Sales Support Menu
            </a>
            <ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
              <li><a class="dropdown-item" target="_blank" href="https://www.loqate.com/anz/contact/">Contact Sales</a></li>
              <li><a class="dropdown-item" target="_blank" href="https://developer.mastersoftgroup.com/harmony/api/method/address.html">API Documentation</a></li>
              <li><a class="dropdown-item" target="_blank" href="https://www.loqate.com/anz/support/">Contact Support</a></li>
            </ul>
          </div>
        </div>

      </div>
    </div>
  </nav>

  <div class="accordion" id="accordionExample">
    <div class="accordion-item">
      <h2 class="accordion-header" id="headingOne">
        <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
          Settings
        </button>
      </h2>
      <div id="collapseOne" class="accordion-collapse collapse show" aria-labelledby="headingOne" data-bs-parent="#accordionExample">
        <div class="accordion-body">
          <div class="row">
            <form class="row g-3">
              <div class="col-auto">
                <label for="env" class="visually-hidden">Env</label>
                <select class="form-control" id="env">
                  <option value="https://hosted.mastersoftgroup.com">Production</option>
                  <option value="https://preview.harmonyrightaddress.net">Preview</option>
                  <option value="https://test.harmonyrightaddress.net">Test</option>
                  <option value="https://dev.harmonyrightaddress.net">Dev</option>
                </select>
              </div>
              <div class="col-auto">
                <label for="apiUser" class="visually-hidden">API User</label>
                <input type="text" class="form-control" id="apiUser" placeholder="API User">
              </div>
              <div class="col-auto">
                <label for="password" class="visually-hidden">Password</label>
                <input type="password" class="form-control" id="password" placeholder="Password">
              </div>
              <div class="col-auto">
                <button class="btn btn-primary mb-3" onclick="return start(true)">Start</button>
                <button class="btn btn-light mb-3" type="button" data-bs-toggle="collapse" data-bs-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">
                  Options
                </button>

              </div>
            </form>

            <div>

              <div class="collapse" id="collapseExample">
                <div class="card card-body">

                  <div class="row">

                    <div class="col-md-4">
                      <div class="form-floating">
                        <input type="text" class="form-control" id="hits" placeholder="Top Hit Number" value="10">
                        <label for="hits">Top Hit Number</label>
                      </div>
                    </div>

                    <div class="col-md-4">
                      <div class="form-floating">
                        <input type="text" class="form-control" id="minLength" placeholder="Min Length" value="3">
                        <label for="minLength">Min Length to Start Search</label>
                      </div>
                    </div>

                    <div class="col-md-4">
                      <div class="form-floating">
                        <select class="form-select" aria-label="Environment" id="caseType">
                          <option value="UP">Upper</option>
                          <option value="LOW">Lower</option>
                          <option value="TITLE">Title</option>
                        </select>
                        <label for="caseType">Case Type</label>
                      </div>
                    </div>

                  </div>

                  <p />

                  <div class="row">
                    <div class="col-md-4">
                      <div class="form-floating">
                        <select id="bnCountry" class="form-select">
                          <option value="AU">Australia</option>
                          <option value="NZ">New Zealand</option>
                        </select>
                        <label for="bnCountry" class="form-label">Country</label>
                      </div>
                    </div>

                    <div class="col-md-4">
                      <div class="form-floating">
                      <select id="bnStatus" class="form-select">
                        <option value="">ALL</option>
                        <option value="act">Active</option>
                        <option value="can">Cancelled</option>
                      </select>
                      <label for="bnStatus" class="form-label">Business Number Status</label>
                      </div>
                    </div>

                    <div class="col-md-4">
                      <div class="form-floating">
                      
                      <select id="taxStatus" class="form-select">
                        <option value="">ALL</option>
                        <option value="act">Active</option>
                        <option value="can">Cancelled</option>
                        <option value="non">None</option>
                      </select>
                      <label for="taxStatus" class="form-label">Tax Status</label>
                      </div>
                    </div>
                  </div>

                  <p />

                  <div class="mb-3">
                    <label class="form-label">States</label>
                    <div class="row">
                      <div class="col">
                        <input name="states" type="checkbox" value="NSW" id="statesNSW" checked />
                        <label for="statesNSW">NSW</label>
                      </div>

                      <div class="col">
                        <input name="states" type="checkbox" value="VIC" id="statesVIC" checked />
                        <label for="statesVIC">VIC</label>
                      </div>

                      <div class="col">
                        <input name="states" type="checkbox" value="QLD" id="statesQLD" checked />
                        <label for="statesQLD">QLD</label>
                      </div>

                      <div class="col">
                        <input name="states" type="checkbox" value="ACT" id="statesACT" checked />
                        <label for="statesACT">ACT</label>
                      </div>

                      <div class="col">
                        <input name="states" type="checkbox" value="SA" id="statesSA" checked />
                        <label for="statesSA">SA</label>
                      </div>

                      <div class="col">
                        <input name="states" type="checkbox" value="WA" id="statesWA" checked />
                        <label for="statesWA">WA</label>
                      </div>

                      <div class="col">
                        <input name="states" type="checkbox" value="NT" id="statesNT" checked />
                        <label for="statesNT">NT</label>
                      </div>
                    </div>
                  </div>
                  <p />
                  <div class="mb-3">
                    <label class="form-label">Name Types</label>
                    <div class="row">

                      <div class="col">
                        <input name="nameTypes" type="checkbox" value="MN" id="nameTypesMN" checked />
                        <label for="nameTypesMN">MN</label>
                      </div>

                      <div class="col">
                        <input name="nameTypes" type="checkbox" value="BN" id="nameTypesBN" checked />
                        <label for="nameTypesBN">BN</label>
                      </div>

                      <div class="col">
                        <input name="nameTypes" type="checkbox" value="TRD" id="nameTypesTRD" checked />
                        <label for="nameTypesTRD">TRD</label>
                      </div>

                      <div class="col">
                        <input name="nameTypes" type="checkbox" value="OTN" id="nameTypesOTN" checked />
                        <label for="nameTypesOTN">OTN</label>
                      </div>

                      <div class="col">
                        <input name="nameTypes" type="checkbox" value="LGL" id="nameTypesLGL" checked />
                        <label for="nameTypesLGL">LGL</label>
                      </div>

                      <div class="col">
                        <input name="nameTypes" type="checkbox" value="DGR" id="nameTypesDGR" checked />
                        <label for="nameTypesDGR">DGR</label>
                      </div>

                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>

      </div>
    </div>

    <div class="accordion-item invisible" id="businessDemo">
      <h2 class="accordion-header" id="headingTwo">
        <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
          Demo
        </button>
      </h2>
      <div id="collapseTwo" class="accordion-collapse collapse" aria-labelledby="headingTwo" data-bs-parent="#accordionExample">
        <div class="accordion-body">

          <div class="row">
            <div class="col-12">
              <div id="business-form">
                <h5>Business name</h5>
                <p style="font-style:italic">Search by typing Name OR Business Number OR Company Number</p>
                <div>
                  <input type="text" id="name" class="form-control" placeholder="Type in business name here e.g. CHRISTINE REED " autocomplete="off" />
                </div>
                <div class="visually-hidden">
                  <div class="col-6">
                    <input id="outputBn" name="outputBn" class="form-control-plaintext visually-hidden" type="text" placeholder="ABN Result" readonly="readyonly" />
                  </div>
                  <div class="col-6 hidden"><input id="outputCn" name="outputCn" class="form-control-plaintext visually-hidden" type="text" placeholder="ACN Result" readonly="readyonly" />
                  </div>
                </div>
                </br>
                <h5>Response</h5>
                <p style="font-style:italic">Full response from selection Business Retrieve API</p>
                <div class="card card-body">
                  <pre id="json"></pre>
                  <div id="error"></div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>

    </div>

  </div>

  <link rel="stylesheet" type="text/css" href="https://common.mastersoftgroup.com/scripts/harmony-2.1.0.min.css">
  <script src="https://common.mastersoftgroup.com/scripts/harmony-2.1.0.min.js" type="text/javascript"></script>
</div>

              
            
!

CSS

              
                
              
            
!

JS

              
                let al = null;

function start(show) {
  var input = document.getElementById("name");
  var outputBn = document.getElementById("outputBn");
  var outputCn = document.getElementById("outputCn");
  
  var env = document.querySelector('#env').value;
  var user = document.querySelector('#apiUser').value;
  var password = document.querySelector('#password').value;
  
  var minLength = document.querySelector('#minLength').value;
  var hits = document.querySelector('#hits').value;
  var caseType = document.querySelector('#caseType').value;
  
  var country = document.querySelector('#bnCountry').value;
  
  Harmony.useEnv(env);

  // Create an api user via the console with domain cdpn.io
  Harmony.init(user, password, Harmony.AUSTRALIA);

  var opt = {
    // optional, min 3 chars to trigger the lookup
    minLength: minLength,
    //optional, number of candidates to return from search, default is 20
    hits: hits,
    //optional, case type for the name of business entities, default is whatever the case in the sot
    caseType: caseType,
    //optional element of bnStatus or string, default is all status
    bnStatus: bnStatus,
    //optional element of taxStatus or string, default is all status
    taxStatus: taxStatus,
    //optional, checkbox name for state selection or input element for state, default is all states
    state: "states",
    //optional, checkbox name for nameTypes selection or input element for nameTypes, default is all types
    nameTypes: "nameTypes",

    //optional element of country or string or select element of country default is au
    country: country,
    
    fieldBn: outputBn,
    fieldCn: outputCn,

    onSelect: function (ui) {
      console.log("address selected: " + JSON.stringify(ui));
    },

    onRetrieve: function (ui) {
      document.getElementById("json").innerText = JSON.stringify(
        ui.onRetrieveItem,
        null,
        2
      );
    }
  };

  if (al) {
    al.autocomplete.destroy();
    al = null;
  }
  al = HraBusinessJS.businessAutoComplete(input, opt);
  
  if (show) {
    document.getElementById("businessDemo").setAttribute("class", "accordion-item visible");

    var demoEl = document.getElementById("collapseTwo");
    bootstrap.Collapse.getOrCreateInstance(demoEl).show();    
  }
  return false;
}

const matchedEls = document.querySelectorAll('.form-control, .form-select');

matchedEls.forEach(e => e.addEventListener('change', (event) => {start(false);}));


              
            
!
999px

Console