home/Everything else/Capture sample code/Address validate/Singleline

Singleline

The Singleline workflow provides address search in Singleline mode where an address can be searched on by entering it in a single textbox. Once this workflow is enabled, sample.html will render additional html elements:

Simple integration

  1. Import singleline.js to your html page:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
         <title>Singleline Address Search</title>
         <script type="text/javascript" src="js/jquery-1.11.2.min.js"></script>
         <script type="text/javascript" src="js/singleline.js"></script>
    </head>
    <body>
    </body>
</html>
  1. Define a <div> element in the <body> tag. The <div> element will be the container of the UI elements that will be auto-generated by the singleline.js script. In this instance, it is named as "container".

  2. Define a <textarea> element in the <body> tag. The <textarea> element will be used to display the address validation result:

<body>
     <br />
     <textarea id="result" style="width:330px; height:630px">
     </textarea>
</body>
  1. Initialize the search by selecting the <div> element and calling the singlelineSearch function.

  2. Assign both the onSuccessHandler and onErrorHandler functions:

  • onSuccess will be called whenever the address is validated
  • onError will be called whenever there is an error in validating the address
<body>
   <br>
   <textarea id="result" style="width:330px;height:630px"></textarea>
</body>

Address validate