" /> " /> " /> "> "> "> The
University of Texas at Austin
Skip to page content.
Information Technology Services
About ITS ITS Services Contact ITS ITS Departments ITS Employment ITS News ITS Help Desk

| | | | |
| header |

Putting it all Together



Advantages of Online Surveys

Disadvantages of Online Surveys

Designing the Questionnaire

Creating the Questionnaire

Data Collection

Data Analysis

Getting Good Data

Ethical Issues and "Netiquette"

Putting it all Together



I need to collect information from a large number of people.

Step 1: Prepare your computer account with AMS service.

Step 2: Create a Web form and create a database to hold the data from the form. Remember, the database field names must be the same names you are using in the form. The database can have more fields than are in your form, but each element of the form must have a corresponding field in the database with the same name.

Step 3: Write the ColdFusion scripts that will process the data from the form. There is an application.cfm file for security, a script that will take the data from the form and put it into the database (populate the database), and a third script that will display the contents of the database.

The application.cfm file can look like this:

<cfapplication name="security"

<!--- Set application constants _--->

<cfset application.mydatasource_username="admin">
<cfset application.mydatasource_password="whatever">

The script that populates the database is called update.cfm and can look like this:

<cfif '#name#' is "" or '#color#' is "" or '#age#' is "" or '#vacation#' is "">

Please use the browser back button and fill out every form field.



<cfelseif isnumeric(form.age) is "no">

Please use the back button and enter a number for your age!


<cfquery name="addinginfo" datasource="teamweb_surveyclass" username="#application.teamweb_surveyclass_username#" password="#application.teamweb_surveyclass_password#">

insert into form


<head><title>Record Added</title></head>
<h1>New record added to database</h1>


Record <b>#name#</b> added.


The script that displays the database contents is called show.cfm and can look like this:

<CFQUERY name="x1" datasource="teamweb_surveyclass" username="#application.survey_class_username#" password="#application.survey_class_password#">

SELECT * from form

<table border="1" cellpadding="4" cellspacing="4">

<th>Favorite Color</th>
<th>Favorite Vacation Spot</th>
<CFOUTPUT query="x1">


Step 4: Put my web form on a web page and ask folks to fill it out.

Step 5: When people click submit, the "action" variable in the form tag calls update.cfm. Update.cfm takes the data from the form and puts it into the database. The form tag looks like:

<form name="create" method="post" action="http://web.austin.utexas.edu/pathtoscript/update.cfm">


Data Checking: I want to make sure the name and age fields are not blank and that what they've put as their age is, in fact, numeric between 5 and 55. I perform these validations in the form by adding a hidden field to each field that I want to test. For example, to make sure the name field is not blank I add a second input tag:

<input type="text" name="name">
<input type="hidden" name="name_required" value="Please enter your name">

The following input tags will verify that the age field is not blank and is numeric between 15 and 55:

<input type="hidden" name="age_required" value="Please enter your age">
<input type="hidden" name="age_integer" value="Please enter your age">
<input type="hidden" name="age_range" value="min=15 max=55">

ColdFusion has seven basic validation rules:

_date Date in most common formats like MM/DD/YY and MM/DD/YYYY
_eurodate Date as DD/MM/YY
_float Numeric data, decimal point allowed

Numeric data, decimal point not allowed.

_range Range of values, the minimum and maximum values (or just one of them) must be specified in the VALUE attribute as MIN= and MAX=, for example, "MIN=5 MAX=10"
_required Field is required and may not be left blank.
_time Time in most common time formats.


(must be between 15 and 55)

Where would you like to go on vacation?

Step 6: I want to display the contents of the database on a Web page. The script that does that is called show.cfm.

Step 7: To perform data analysis, I will import this Microsoft Access database into SAS or SPSS. If you need assistance with this step, the ITS Statistical Support Web site is available. In addition, consulting is provided .

A sample Microsoft Access database can be downloaded for you to examine. (Download MS Access Viewer)



Information Technology Services. Infrastructure. Innovation. Integrity.

Last updated .
Copyright © , Information Technology Services at The University of Texas at Austin.
All rights reserved. For privacy concerns read our privacy policy.

To submit questions or comments regarding this page, use the online Comment Form. Send questions or comments regarding this page to ">. Send computing questions to the ITS Help Desk or call (512) 475-9400.