If anyone has been able to automatically populate address fields on a Laserfiche form by undertaking a lookup of a UK postcode (or a US zip code) and the user selecting the relevant address from a dropdown option field can you please help me by explaining how this can be achieved.
Question
Question
Forms: Auto-populate address fields via UK postcode (or US zip code) lookup
Replies
Hi John,
First you would need a database with all of the postcodes with addresses. This will be the hard bit but it seems you can get an online example here -
http://www.doogal.co.uk/files/postcodesMdb.zip
Then you need to import this into a SQL database or an alternative ODBC provider and set this up as a DB look-up within the form. Pretty straight forward I suppose. Just a potentially massive DB it needs to perform the look-up on.
Hope this helps! ![]()
John,
I was able to get the following code to work with Forms 9.2 but it appears that http://ziptasticapi.com only works with US zip codes. You would need to find a similar API for UK postal codes. A quick google search =https://postcodes.io/docs might do the trick.
Zip code input class = zip
City class = city
State class = state
//Start Zip Code Lookup
$(document).ready(function () {
$('.zip').change(function(){
var zipCode = $('.zip input').val();
var requestURL = 'http://ziptasticapi.com/' + zipCode + '?callback=?';
$.getJSON(requestURL, null, function(data){
console.log(data)
if (data.city) $('.city input').val(data.city);
if (data.state) $('.state input').val(data.state);
});
});
});
//End zip code lookup
Hope this helps!
Nate