Form Address Verification Plugin for jQuery - liveaddress

File Size: 1.11 MB
Views Total: 6846
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Form Address Verification Plugin for jQuery - liveaddress

liveaddress is a jQuery plugin which takes advantage of LiveAddress API to add a powerful and real-time address verification to your form when submitting. Licensed under the GPLv3.

You might also like:

How to use it:

1.  Include jQuery library and liveaddress.js

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="jquery.liveaddress.js"></script>

2. Create a form

<form>
<input type="text" name="street">
<input type="text" name="city">
<input type="text" name="state">
<input type="text" name="zip">
<input type="submit" value="Submit Form">
</form>

3. Initialize the plugin with an HTML key from your account:

/** CONFIGURE **/

// Put your HTML key here
var htmlKey = "HTML_KEY"; 

// Toggle debug mode
var debug = true; 

// The version of this test runner page
var testRunnerVersion = "1.1.4";  


/** PREPARE FORM(S) **/

$(function()
{
  $('form#submitEvent').submit(function() {
alert("Form submit. Verification should happen first (if necessary), then this should occur.");
  });
});


/** INITIALIZE **/

var liveaddress = $.LiveAddress({
key: htmlKey, // An HTML key from your account
debug: debug // Show debug stuff

});

4. All the default settings.

// Number of suggestions to show if ambiguous
candidates: 3,      

// Number of autocomplete suggestions; set to 0 or false to disable                        
autocomplete: 10,  

// API endpoint                         
requestUrl: "https://api.smartystreets.com/street-address",       

// How long to wait before the request times out (5000 = 5 seconds)
timeout: 5000,                    

// Animation speed          
speed: "medium",         

// Message when address is ambiguous                   
ambiguousMessage: "Choose the correct address", 

// Message when address is invalid            
invalidMessage: "Address not verified",     

// Selector for possible address-related form elements            
fieldSelector: "input[type=text], input:not([type]), textarea, select", 

// Selector to find a likely submit button or submit image (in a form)
submitSelector: "[type=submit], [type=image], [type=button]:last, button:last"  

Change Logs:

v2.6.0 (2015-03-21)

  • update.

v2.4.10 (2014-03-04)

  • Fixed a script injection vulnerability

v2.4.9 (2013-11-13)

  • IE9 compatibility fix 

v2.4.8 (2013-09-21)

  • Fixed a critical infinite loop bug by removing "syncWithDom" feature

v2.4.7 (2013-07-16)

  • Some new customizations
  • Removed "primary" as a label qualifier because of false positives
  • More helpful title with small browser tabs

This awesome jQuery plugin is developed by smartystreets. For more Advanced Usages, please check the demo page or visit the official website.