Integration Introduction

Step 1 – Include Files

HTML – Include CSS

<head>
    <link rel="stylesheet" type="text/css" href="https://trial.serviceobjects.com/Resources/AC/CSS/ACStyle.css" />
    .
    .
    .
</head>

HTML – Include JavaScript

<body>
    <script type="text/javascript" src="https://trial.serviceobjects.com/Resources/AC/JS/ACScriptV1.04.js"></script>
    .
    .
    .

Step 2 – Map Fields

Input Fields to Map

<div id="sAddress" class="AddressInputBlock">
    <div id="lAddress2" class="AddressLabels">Address One</div>
    <input id="iAddress1" type="text" class="AddressInputs" />
</div>
<div id="sAddress2" class="AddressInputBlock">
    <div id="lAddress2" class="AddressLabels">Address Two</div>
    <input id="iAddress2" type="text" class="AddressInputs" />
</div>
<div id="sAddress3" class="AddressInputBlock">
    <div id="lAddress3" class="AddressLabels">Address Three</div>
    <input id="iAddress3" type="text" class="AddressInputs" />
</div>
<div id="sUnits" class="AddressInputBlock">
    <div id="lUnits" class="AddressLabels">Unit</div>
    <input id="iUnits" type="text" class="AddressInputs" />
</div>
<div id="sLocality" class="AddressInputBlock">
    <div id="lLocality" class="AddressLabels">Locality</div>
    <input id="iLocality" type="text" class="AddressInputs" />
</div>
<div id="sAdminArea" class="AddressInputBlock">
    <div id="lAdminArea" class="AddressLabels">Administrative Area</div>
    <input id="iAdminArea" type="text" class="AddressInputs" />
</div>
<div id="sPostal" class="AddressInputBlock">
    <div id="lPostal" class="AddressLabels">Postal Code</div>
    <input id="iPostal" type="text" class="AddressInputs" />
</div>
<div id="sCountry" class="AddressInputBlock">
    <div id="lCountry" class="AddressLabels">Country</div>
    <input id="iCountry" type="text" class="AddressInputs" />
</div>

Field Mapping

<script>
     var fields = [
                { element: "iAddress1", field: "Address1", mode: so.fieldMode.SEARCH | so.fieldMode.POPULATE },
                { element: "iAddress2", field: "Address2", mode: so.fieldMode.POPULATE },
                { element: "iAddress3", field: "Address3", mode: so.fieldMode.POPULATE },
                { element: "iUnits", field: "SubPremise", mode: so.fieldMode.POPULATE },
                { element: "iLocality", field: "Locality", mode: so.fieldMode.POPULATE },
                { element: "iAdminArea", field: "AdminArea", mode: so.fieldMode.POPULATE },
                { element: "iPostal", field: "PostalCode", mode: so.fieldMode.POPULATE },
                { element: "iCountry", field: "Country", mode: so.fieldMode.POPULATE }
             ];
</script>

Step 3 – Set Options: (A) Address Search Type

Setting Options

var fields = [
                { element: "iAddress1", field: "Address1", mode: so.fieldMode.SEARCH | so.fieldMode.POPULATE },
                .
                .
                .
                { element: "iCountry", field: "Country", mode: so.fieldMode.POPULATE }
             ];
 
 
var CustomKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
var options = { key: CustomKey, setBiasToIP: true };
var DOTSGlobalAddressComplete = new so.Address(fields, options);

*Note, the true/false values are boolean values and not strings.

Step 3 – Set Options: (B) Locality Search Type

Set Options: (B) is just a bit of a helper so you can see the difference side by side between the address prediction and place prediction.  The guide Quick Integration Guide – Place Predict will be exclusively about this functionality.

Setting Options

var fields = [
                { element: "iAddress1", field: "Address1", mode: so.fieldMode.SEARCH | so.fieldMode.POPULATE },
                .
                .
                .
                { element: "iCountry", field: "Country", mode: so.fieldMode.POPULATE }
             ];
 
 
var CustomKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
var options = { key: CustomKey, setBiasToIP: true, DoPlace: true, SearchType: "Locality" };
var DOTSGlobalAddressComplete = new so.Address(fields, options);

*Note, the true/false values are boolean values and not strings.