ColdFusion8-Demographics

From CDYNE Wiki
Jump to navigation Jump to search

Tested with ColdFusion8 and Dreamweaver CS4

CFM1-Demographics.gif


Make sure you add the Web Services WSDL in the Dreamweaver 'Components' toolbar.

http://ws.cdyne.com/psaddress/addresslookup.asmx?wsdl

Dreamweaver-components.gif


demographics.cfm

  1    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
  2   	"http://www.w3.org/TR/html4/loose.dtd">
  3   <html>
  4   <head>
  5   <title>Form Page</title>
  6   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  7   </head>
  8   <body> 
  9  <!--- If the form is submitted, call demographics web service --->
 10  <cfif isDefined("FORM.Submit")>
 11  <cfinvoke 
 12  webservice="http://ws.cdyne.com/DemographixWS/DemographixQuery.asmx?wsdl"
 13  method="getLocationInformationByAddress"
 14  returnvariable="aSummaryInformation">
 15  	<cfinvokeargument name="addressLine1" value=#FORM.Address#/>
 16  	<cfinvokeargument name="city" value=#FORM.City#/>
 17  	<cfinvokeargument name="stateAbbrev" value=#FORM.State#/>
 18  	<cfinvokeargument name="zipCode" value=#FORM.Zip#/>
 19  	<cfinvokeargument name="licenseKey" value="0ce54535-e73d-4346-9e22-31435b0d7d66"/>
 20  </cfinvoke>
 21   <table width="660" border="0" cellspacing="0" cellpadding="0">
 22    <tr>
 23     ZIP + 4 Demographic Information<br /><br />
 24      <td>
 25      Average Age : <cfoutput>#aSummaryInformation.MedianAge#</cfoutput> Years<br />
 26  	Average Income : $<cfoutput>#aSummaryInformation.MedianIncome#</cfoutput><br />
 27  	Rooms in Home : <cfoutput>#aSummaryInformation.MedianRoomsInHouse#</cfoutput><br />
 28  	Home Value : $<cfoutput>#aSummaryInformation.MedianHouseValue#</cfoutput><br />
 29  	Automobiles Per Home : <cfoutput>#aSummaryInformation.MedianVehicles#</cfoutput><br />
 30  	</td>
 31      <td>
 32  	Married : <cfoutput>#aSummaryInformation.MaritalStatusPercentages.Married#</cfoutput>%<br />
 33  	Separated : <cfoutput>#aSummaryInformation.MaritalStatusPercentages.Separated#</cfoutput>%<br />
 34  	Divorced : <cfoutput>#aSummaryInformation.MaritalStatusPercentages.Divorced#</cfoutput>%<br />
 35      Widowed : <cfoutput>#aSummaryInformation.MaritalStatusPercentages.Widowed#</cfoutput>%<br />
 36  	Never Married : <cfoutput>#aSummaryInformation.MaritalStatusPercentages.NeverMarried#</cfoutput>%<br />
 37  	</td>
 38      <td>
 39      African American: <cfoutput>#aSummaryInformation.RacePercentages.Black#</cfoutput>%<br />
 40  	Asian Percentage : <cfoutput>#aSummaryInformation.RacePercentages.Asian#</cfoutput>%<br />
 41   	White Percentage : <cfoutput>#aSummaryInformation.RacePercentages.White#</cfoutput>%<br />
 42  	Mixed Percentage : <cfoutput>#aSummaryInformation.RacePercentages.Mixed#</cfoutput>%<br />
 43  	Other Race Percentage :  <cfoutput>#aSummaryInformation.RacePercentages.Other#</cfoutput>%<br />
 44  	</td>
 45    </tr>
 46   </table>
 47   <br /><br />
 48   </cfif>
 49   <!--- Begin ColdFusion Form ---> 
 50   <cfform name="Form" action="demographics.cfm" method="post">  
 51 	<table width="400" border="0" cellspacing="0" cellpadding="3"> 
 52  		<tr> 
 53  			<td align="right">Address:</td> 
 54  			<td> 
 55  				<!--- Address textfield - REQUIRED ---> 
 56  				<cfinput 
 57  					type="text" 
 58  					name="Address" 
 59  					size="30" 
 60  					required="yes" 
 61  					message="Please enter your Address">
 62  			</td> 
 63  		</tr> 
 64  		<tr> 
 65  			<td align="right">City: </td> 
 66  			<td> 
 67  				<!--- City textfield - REQUIRED ---> 
 68  				<cfinput 
 69  					type="text" 
 70  					name="City" 
 71  					size="30" 
 72  					required="yes" 
 73  					message="Please enter your City">
 74  			</td> 
 75  		</tr> 
 76  		<tr> 
 77  			<td align="right">State:</td> 
 78  			<td> 
 79  				<!--- State textfield - REQUIRED ---> 
 80  				<cfinput 
 81  					type="text" 
 82  					name="State" 
 83  					size="30" 
 84  					required="yes" 
 85  					message="Please enter your State">
 86  			</td> 
 87  		</tr> 
 88          		<tr> 
 89  			<td align="right">Zip:</td> 
 90  			<td> 
 91  				<!--- State textfield - REQUIRED ---> 
 92  				<cfinput 
 93  					type="text" 
 94  					name="Zip" 
 95  					size="30" 
 96  					required="yes" 
 97  					message="Please enter your Zip">
 98  			</td> 
 99  		</tr> 		
100  		<tr> 
101  			<td align="right">&nbsp;</td> 
102  			<td> 
103  				<!--- Submit button ---> 
104  				<input type="submit" name="Submit" value="Check Address"> 
105  			</td> 
106  		</tr> 
107  	</table> 
108  	<!--- End ColdFusion Form ---> 
109   </cfform> 
110   </body>
111   </html>