|
Tutorial
Video : Explain this functionality
The above functionality can be installed in minutes....in 5 easy
steps.....
The
above Postcode Lookup for full Address search functionality can be added to a
ASP web
page in minutes, by simply dropping the supplied files into your
ASP project.
Advantages
-
"Out of the box"
Full Postcode Address Search solution
-
Uses standard
ASP Components
-
Very little
programming required, easily customised by editing file
simple parameters.
-
Quick
to install, drop supplied files into Classic ASP Project
-
Easily
customisable
window, [More
Info]
-
Will
run on most Microsoft Web servers
-
Not
blocked by Pop-up blockers
-
Data always up
to date
-
No Data
Administration Cost for you
[.NET
version of this] [PHP
version of this]
Step1: Download the Example Code
Simply
download the code. The code is in the "ASP Full Address
Web Pop-up" directory of our example downloads. Then
drag and drop the directories "SimpLookup1" and "SimplyLookupImages",
to your own ASP Web Project (same directory as the page as you
want to add the Postcode Lookup Pop-up too
[Click
here to download the Examples]
Example of copying the code into your project
For
example, if we want to add Postcode Lookup Pop-up to a project,
with "default.asp" the main form, then we drop the directories in to achieve:

Step 2 : Add our code to your page .asp page
Then
on your own web page, "default.asp" in our example,
we add just
above </body> tag:
Example include the Postcode Lookup window code in your page
<!--#include
file="Simplylookup1/PopupWindowCode.htm" -->
This
adds all the code required to show the DHTML Web Pop-up.
Step 3 : Add a Link, button or image to activate Postcode
Lookup
Then
add
either a link, using the following code to activate the Postcode
Lookup Web pop-up:
Example link to activate Postcode Lookup Window:
<a
href="javascript:loadwindow(
'SimplyLookup1/simplypostcode_Address1.asp?mapvalue=1',420,450)"
>Lookup
Address from link</a>
Example Button to activate Postcode Lookup Window:
<input
type=button value="Lookup Address"
onClick="javascript:loadwindow(
'SimplyLookup1/simplypostcode_Address1.asp?mapvalue=1',420,450)">
This
could easily be changed to use a image button.
Example prime Postcode Lookup Window:
simplypostcode_Address1.aspx?postcode=PE132QL&mapvalue=1
will prime the search window with a postcode when opened
The
Parameter "&mapvalue" allows one popup to provide
mapping to more than one main form ("default.asp"
in our example)
Step 4 : Map your Address fields
Now
edit the JavaScript at the end of file "simplypostcode_Address2.asp",
to
write the correct address lines, which result from the
Postcode Lookup. Back to your target web page, address
fields:
Example address field mappings:
<script>
window.parent.document.forms[0].T1.value = Company
window.parent.document.forms[0].T2.value = Line1
window.parent.document.forms[0].T3.value = Line2
window.parent.document.forms[0].T4.value = Line3
window.parent.document.forms[0].T5.value = Town
window.parent.document.forms[0].T6.value = County
window.parent.document.forms[0].T7.value = Postcode
window.parent.document.forms[0].T8.value = Country
window.parent.document.forms[0].T9.value = MultiLineAddress
...
</script>
Where
T1-T9 are the address fields you want to fill in on your web
page, "default.asp" in our example.
Note we have hidden the mapping select statement, which selects
different address field mappings based on the parameter "mapvalue".
The
"MultiLineAddress" variable shows how to assign the
address to a "Memo" field. Or in other words, a
field which holds all of the address information, which the user
searched for. This can be removed if not used.
Step 5 : Specify then Data Key
Open
an account with us. Within seconds you will then
receive a data key, by e-mail, which should be put in "Settings.asp"
file. This key will enable your account, for a 30
day evaluation period.
[Open
your account]
Enter
Postcode "ZZ99" to use test data
Requirements:
-
Windows Server capable of
running ASP
-
Uses "MSXML2.ServerXMLHTTP"
but by changing one line in Settings.asp, can use the older
"Microsoft.XMLHTTP" which is installed on all ASP
servers.
-
The code should
be place in the same domain as your web page, else the
Postcode Lookup window will not be able to write data back
to parent page
-
Cookies are required if used for Internal use, as
user the must be identifiable to comply with our End User
Agreement
-
Cookies are NOT required for Web use.
The code will NOT use cookies if you use a Web License data
key
[What is the Web use, Internal use]
Compatibility:
- IE5+: IE 5
and above
- FF1+:
Firefox 1.0+. NS6+ and FF beta are assumed as well.
- Opr7+:
Opera 7 and above.
Optional Customisation
The
Pop-up window can be customised in many ways:

The "Settings.asp"
code file has many constants which define the above
areas, which can be easily customised.
The
"SimplyLookupImages" sub-directory, contain the images used to create
the window appearance. You could replace these to
change the complete look of the DHTML Web Pop-up window.
The
Simply Postcode Lookup code has been place in a sub-directory
called "SimplyLookup1".
Additional Notes:
The
pop-up window is programmed to appear in the middle of the
browser window, but by altering the loadwindow
function the position can be set
function
loadwindow(url,width,height,xpos,ypos){
if (!ie5&&!ns6)
window.open(url,"","width=width,height=height,scrollbars=1")
else{
document.getElementById("SimplyLookupWindow").style.display=''
document.getElementById("SimplyLookupWindow").style.width=
initialwidth=width+"px"
document.getElementById("SimplyLookupWindow").style.height=
initialheight=height+"px"
document.getElementById("SimplyLookupWindow").style.left=xpos+"px"
document.getElementById("SimplyLookupWindow").style.top=ns6?
window.pageYOffset*1+ypos+"px" :
iecompattest().scrollTop*1+ypos+"px"
document.getElementById("SimplyLookupWindowFrame").src=url
}
}
The simply specify the x,y
co-ordinates in the open call (step 3)
<a
href="javascript:loadwindow(
'SimplyLookup1/simplypostcode_Address1.php',420,450,100,30)"
>Lookup
Address from link</a>
For more information on how the popup
window works see:
http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow.htm
|