Drop down select boxes which were created from a database query of state and country tables using cfloop to build the drop down content
coding used to build the "States" dynamic select:
<select name="state" size="1">
<option value="" selected>Select a State</option>
<cfloop query="getStates"><option value="#state#">#state#</option></cfloop>
</select>
The "States" select coding starts with a hard coded "" blank select statement which has the text "Select a State" as the display and is set as "selected" so that it displays as the default. Then the cfloop statement goes through the database recordset named getStates which was build using a cfquery of the states database and selecting all of the 50 contiguous states in the database. The database contains US Territories and Canadian Provinces which were excluded in the query.
coding used to build the "Countries" dynamic select:
<select name="country" size="1">
<cfloop query="getCountry"><option value="#country#"<cfif country eq "United States">selected</cfif>>#country#</option></cfloop>
</select>
The Countries functions exactly the same way as the states drop down except there is no blank select and the default (selected) entry is set using a cfif to set the default to United States (you can default to the UK or Canada or ANY country in the list). The cfif statement checks each record as it is displayed to see if it is "United States" and when that one is found it sets the "selected" trigger in the option causing that country to be the one initial selected in the drop down box.
All in all it is only 1 line of code to create either of these drop down boxes dynamically using ColdFusion. You can view source to see how much HTML a single cfloop statement writes automatically.
Since this query and draw is a one page one time event a simple MS Access database can be used to hold the states and countries. This database can be populated using a simple csv text file (comma separated values) which are easily found by googling for csv states or csv countries. I build the states table from a csv file that I found on a google search.
To enter this into a Fusion Combo Box you would press the HTML button on the Forms Combo Box Properties palette and insert the single line containing the cfloop in the inside the tag tab. Fusion will write the all of the other necessary select box coding. All you have to do is insert a single line of code.