FusionMaps with ASP > Using Data from Form |
In this section, we will see how to generate a FusionMap using data collected from Form. |
For the sake of demo, let us take the example of a fictional company that wants to plot the world-wide sales report for a particular day on a map. The example first loads a page that has a form to accept data for all the continents. Here, we have put some default data which can be modified as per user's wish. This data will be submitted to another ASP page. This page will acquire the data and plot it on the map. For the sake of simplicity, we wouldn't do any processing or checking on this data. However, your real life applications might process data before presenting it on the map. |
Before proceeding further, we recommend to go through the section "How to use FusionMaps" for a better insight. |
The code examples contained in this page are present in Download Package > Code > ASP > FormBased folder. |
Building the Form |
The form is contained in the Default.asp page. Shown below is a snapshot: |
This is a very simple form which submits to FormSubmit.asp. |
Requesting the data and Creating the Map |
The work of requesting the data from submitted form and creating the map is done in FormSubmit.asp, present in the same folder. It contains the following code: |
<%@ Language=VBScript %> <% 'We've included ../Includes/FusionMaps.asp, which contains functions 'to help us easily embed the maps. %> <!-- #INCLUDE FILE="../Includes/FusionMaps.asp" --> <HTML> <HEAD> <TITLE> FusionMaps ASP Sample- Form Based Data Example </TITLE> <% 'We've included FusionMaps.js which helps in 'easy map rendering. %> <script type="text/javascript" language="javascript" src="../JSClass/FusionMaps.js"></script> </HEAD> <BODY> <% 'this page accepts data from submitted by default.asp 'it sets the values for the world map 'We first request the data from the Form Default.asp and store in an array dim dataArray(8,2) 'Storing data from form in array |
Steps involved in this code |
As you can see in the above code, we're doing the following: |
|
Below is the snapshot of the map that we get here. |