Using this Full Address Web Postcode Finder, the user:
This functionality is also available for PHP platform
Please note : This demonstration uses demonstration data unlike the live system
The above Postcode Lookup for Full Address Search functionality can be added to a ASP.NET capable web site in minutes, by simply dropping the supplied files into your Web project. It is available in ASP.NET or C#.
Web server capable of running ASP.NET code in VB/C#.
Does NOT require Microsoft Version of AJAX to be loaded
Simply use the "Sign Up for Trial" link at top right of this page to open a trial account. We will then send you a data key, which is used to identify your account, when using the following service.
Simply download the example code. The code is in the "AJAX/AJAX ASP NET Full Address VB" or "AJAX/AJAX ASP NET Full Address C#" directory of our example downloads. Then copy, into the same directory as your web page which requires Address Lookup, "SPL_AJAX_Full.js", "SPLGetFullAddress1.aspx" and "SPLGetFullAddress2.aspx" files. Download code
SPL_AJAX_Full.js
SPLGetFullAddress1.aspx
SPLGetFullAddress2.aspx
If you wish to have two Full address postcode seaches on one web page, then please use the example in the “AJAX/AJAX ASP NET Full Address 2 Addresses VB” or "AJAX/AJAX ASP NET Full Address 2 Addresses C#" directory. It is significantly different from the single address fill example.
Then on your own web page header, add the following reference to the JavaScript file your copied.
This line is showen in the "index.html" file included in the example download, as is the rest of the code.
index.html
HTML Code in in section
Then add either a link, or button image, using the following code to activate the Postcode Lookup Web address selection list:
HTML in your page Lookup Address from link
Lookup Address from link
HTML in your page onClick= "javascript:SPLGetAddressData(document.getElementById('postcode').value)">
onClick= "javascript:SPLGetAddressData(document.getElementById('postcode').value)">
This could easily be changed to use an image button.
Note: In the above example the Postcode Text field must have an ID of "postcode"
postcode
When the inline selection box is shown for the user to select the address, the following style statements should be added to the header of the page to control the size of the selection box and the text which appears below it.
HTML Code in your page or style sheet
where:
SPLAddressListSt is the style of the address selection box
SPLAddressListSt
SPLAddressListStBottomLine is the style of the line below selection box
SPLAddressListStBottomLine
SPLAddressListStErrorLine is the style of text which appears if Postcode is not found
SPLAddressListStErrorLine
SPLAddressListLicenseLine is the style for the License information. This is only shown if using "Internal License" to show number of Users, etc
SPLAddressListLicenseLine
Of course the above style code can be placed in your own style sheet.
The inline address selection list is shown where you define the SPLSearchArea DIV tag. Basically our Postcode Lookup Server provides the HTML to display the list box in the DIV tag, which is populated by the AJAX call.
SPLSearchArea
HTML in body
In this case in a two column table
Now edit the JavaScript at the end of file "SPL_AJAX_Full.js", to write the correct address lines, which result from the Postcode Lookup, back to your target web page address fields:
JavaScript SPL_AJAX_Full.js document.getElementById("postcode").value=POSTCODE; document.getElementById("line1").value=LINE1; document.getElementById("line2").value=LINE2; document.getElementById("line3").value=LINE3; document.getElementById("town").value=TOWN; document.getElementById("county").value=COUNTY; document.getElementById("country").value=COUNTRY; document.getElementById("company").value=COMP;
document.getElementById("postcode").value=POSTCODE; document.getElementById("line1").value=LINE1; document.getElementById("line2").value=LINE2; document.getElementById("line3").value=LINE3; document.getElementById("town").value=TOWN; document.getElementById("county").value=COUNTY; document.getElementById("country").value=COUNTRY; document.getElementById("company").value=COMP;
Where the fields on your web page all have ID'd expressed:
HTML in FORM line1 size=45> line2 size=45> etc.
line1 size=45> line2 size=45> etc.
The UK Address data returned by the call is similar to our Postcode XML Web service. The full address record is:
XML Data returned 11570840_0E Comtek 44 Victoria Road Wisbech Cambridgeshire PE13 2QL England 2N 1 N PE132QL 18962 19147292 44
11570840_0E Comtek 44 Victoria Road Wisbech Cambridgeshire PE13 2QL England 2N 1 N PE132QL 18962 19147292 44
This type of license returns
Simply run up your page. Right click on page, select view source, and find the ID that ASP has assigned to your ASP Textbox controls.
Probably “MainContent_” is added to start and “ASP” at end if ID you have designated. Thus we could edit the writeback section to read:
JavaScript in SPL_AJAX_Full.js document.getElementById("MainContent_postcodeASP").value = POSTCODE; document.getElementById("MainContent_line1ASP").value = LINE1; document.getElementById("MainContent_line2ASP").value = LINE2; document.getElementById("MainContent_line3ASP").value = LINE3; document.getElementById("MainContent_townASP").value = TOWN; document.getElementById("MainContent_countyASP").value = COUNTY; document.getElementById("MainContent_countryASP").value = COUNTRY;
document.getElementById("MainContent_postcodeASP").value = POSTCODE; document.getElementById("MainContent_line1ASP").value = LINE1; document.getElementById("MainContent_line2ASP").value = LINE2; document.getElementById("MainContent_line3ASP").value = LINE3; document.getElementById("MainContent_townASP").value = TOWN; document.getElementById("MainContent_countyASP").value = COUNTY; document.getElementById("MainContent_countryASP").value = COUNTRY;
Please note, if a major structure change, liek change in Master Page may change the ID's, but otherwise it should remain the same.
Open an account with us. Within seconds you will then receive a data key, by e-mail, which should be put in "SPLGetFullAddress1.aspx" and "SPLGetFullAddress2.aspx" files. This key will enable your account, for a 30 day evaluation period, for one postcode area.
PHP in SPLGetFullAddress1.aspx and SPLGetFullAddress2.aspx Dim DataKey$ = "PUT YOUR DATA KEY HERE"
Dim DataKey$ = "PUT YOUR DATA KEY HERE"
Final step is to test search software. Enter Postcode "ZZ99" to use test data or use our special test postcodes.
The text below the selection box can be changed by editing the following line in the "SPLGetFullAddressStep1.aspx" file:
SPLGetFullAddressStep1.aspx
XMLService += "&text=Please%20Select%20Address"
set to
XMLService += "&text=
to suppress text
When run on a mobile device the address listbox does not expand, due to the way mobile devices work. Instead the address listbox becomes a selection box, and in that selection box are the words “Please select address”. This can be altered by using:
XMLService += "&textmob=Please%20Select%20Address"
To change the number of lines in the selection box edit line 73
XMLService += "&lines=8"
To use a drop down list, instead of selection list, simply set:
XMLService += "&lines=0"
Set to showlic=1 to show License status:
showlic=1
XMLService += "&showlic=1"
When the customer presses the [Find] button, then the function SPLGetAddressData is called, passing the Postcode entered in your Postcode field. This then calls the SPLGetFullAddress1.aspx page with the Postcode in the parameters, using the xmlHttp object created when the page was opened on the browser. This xmlHttp object provides AJAX (Asynchronous JavaScript and XML) to perform a Asynchronous call the SPLGetFullAddress1.aspx page, without a complete page refresh.
The SPLGetFullAddress1.aspx code on your web server then calls our Postcode lookup web server for the address information, adding your account information, etc. This means the client browser never sees your account information.
When the SPLGetFullAddress1.aspx page receives address information from our Postcode lookup server it simply relays it back to the web page (your page with address fields on the customers computer) on the client computer.
The result of SPLGetFullAddress1.aspx is then handled by the JavaScript function SPLhandleRequestStateChange which calls SPLhandleServerResponse when fully complete.
SPLhandleRequestStateChange
SPLhandleServerResponse
Function SPLhandleServerResponse then reads the XML, if it DOES NOT contain tag "" then it writes the response to the DIV SPLSearchArea on your web page. The response contains all the HTML to display the selection list, thus the list appears on your web page on the client computer, in the DIV tag.
When the user clicks on an address line then the function SPLAddressChange gets called, with the ID of the line selected. This function then calls SPLGetFullAddress2.aspx and writes nothing to the DIV tag SPLSearchArea to hide the address selection list.
SPLAddressChange
The web page SPLGetFullAddress2.aspx on your server then again relays the address information from our Postcode address lookup server to the client page on the customers computer.
Function SPLhandleServerResponse then reads the XML returned, if it DOES contain tag "" then it writes the address information to your address fields on your web page. Thus the address has been written to your web page.