University of Plymouth Department of Psychology

Skills Package: How to Put Questionnaires on the Internet: Part 1



Presented by: Dr Paul Kenyon
Here ia a Table of Contents: Part 1

Rationale for Delivering Questionnaires via the Internet

The purpose of this web page is to describe how to go about putting a questionnaire on the Internet. Although this is a relatively straightforward process it may be worth answering the question "Why bother?".

Until recently most psychological questionnaires were delivered to users on paper and the experimenter was faced with the daunting task of manually entering each user's replies into a computer prior to data analysis. This is a tedious and error-prone exercise that we have all done and hated! One advantage of computer based questionnaires is that the data can be collected and stored with a minimum of intervention by the experimenter thus reducing the risk of 'transposition errors'. This type of computer-based questionnaire has been used previously but mounting questionnaires on the Internet offers a further advantage.

Before the advent of Internet-based questionnaires the experimenter was restricted to collecting data from subjects that they actually came into contact with. Usually this meant recruiting subjects on your campus, close neighbourhood or asking a colleague at a remote site to recruit subjects for you. Internet-based questionnaires overcome this problem by allowing people from all over the world that you have never met to participate as subjects in your study.

But like everything in life there are snags: In order to participate in your study respondents must have access to a computer linked to the Internet. This is a problem at the moment - most suitable computers are located in universities or owned by a small number of relatively wealthy people. Hopefully this will change. In the early days of any new technology, the number of users is relatively small, but useful things like telephones, motor cars and TV sets have a habit of being widely adopted across the world.

Nevertheless you should be aware that Internet-users are NOT a random sample of humanity - undergrad students aren't either, but that hasn't stopped their use in a lot of psychology experiments. But more seriously, you don't have the control over who fills in your questionnaire when you put it on the Internet. It is possible to restrict access to your questionnaire using passwords etc. but that is beyond the scope of this document


Creating HTML Forms: A Primer

Before converting your questionnaire into a form that can be viewed by users on the Internet, you need to have the basic understanding of HyperText Markup Language (HTML) which is provided by the following documents



To start an HTML FORM, we need an HTML document. Here is a template for a generic html document:

<html>

<head>

<title>Generic_Page</title>

</head>

<body>



<h1>Generic_Header</h1>



</body>

</html>


All of this should make sense to you, if not you need to read the guides to HTML before you go any further.

Example of Questionnaire on the Internet


Form example Here is an an example of a questionnaire I prepared earlier!. You can examine the complete questionnaire at the URL:
http://salmon.psy.plym.ac.uk/health.htm
Note that this part of the questionnaire contains a pair of 'radio buttons' to allow the user to indicate their gender and a 'text box' in which they enter their nationality.

Here is the HTML code that produced the screen display shown above:
<html>
<head>
<title>Health Role Beliefs Questionnaire</title>
</head>
<body>
<h1><IMG SRC="s_unilog.gif" ALT="University of Plymouth"> Health & Quality of Life Research Centre</h1>
<h2>Health Role Beliefs Questionnaire</h2>
<p> We would like to know your views on the provision of health care.
<br>There is a section at the end of the questionnaire for you to send us any comments.
<br>Thanks for your help.
<FORM METHOD="POST" ACTION="http://www.psy.plym.ac.uk/cgi-win/polyform.exe/health">
<h3>Background information</h3>
<p>What country do you live in?:<INPUT TYPE="text" NAME="01nationality" VALUE=" ">
<p>Sex
<ul>
<li><INPUT TYPE="radio" NAME="02sex" VALUE="female" >Female
<li><INPUT TYPE="radio" NAME="02sex" VALUE="male" >Male
</ul>
....
....
....
HTML code for additional questions would be placed here
....
....
....
The following HTML code is placed at the end of the Form and is not shown in the screen shot above
<INPUT TYPE="hidden" NAME="51date" VALUE="pfDate" >
<INPUT TYPE="hidden" NAME="52longdate" VALUE="pfLongDate" >
<INPUT TYPE="hidden" NAME="53time" VALUE="pfTime" >
<INPUT TYPE="hidden" NAME="54TransactionID" VALUE="pfTransactionID" >
<INPUT TYPE="hidden" NAME="55RemoteHost" VALUE="pfRemoteHost" >
<INPUT TYPE="hidden" NAME="56RemoteAddress" VALUE="pfRemoteAddress" >
<INPUT TYPE="hidden" NAME="57Referer" VALUE="pfReferer" >
<HR SIZE=4>
<INPUT TYPE="submit" VALUE="Transmit"> completed questionnaire to remote computer.
</FORM>
</body>
</html>
You will recognise some of the HTML. For example the HTML at the start is straightforward:
<html>
<head>
<title>Health Role Beliefs Questionnaire</title>
</head>
<body>
<h1><IMG SRC="s_unilog.gif" ALT="University of Plymouth"> Health & Quality of Life Research Centre</h1>
<h2>Health Role Beliefs Questionnaire</h2>
<p> We would like to know your views on the provision of health care.
<br>There is a section at the end of the questionnaire for you to send us any comments.
<br>Thanks for your help.
and you should already know why
</body>
</html>
is at the end

But you may not have seen this HTML tag before. :
<FORM METHOD="POST" ACTION="http://salmon.psy.plym.ac.uk/cgi-win/polyform.exe/health">

We tell the Netscape browser that we are beginning a form by inserting the <FORM ...> element. This element has two attributes that we are concerned with:

The METHOD attribute describes how we are going to get the information the user types into our form sent back across the Internet to the server; the POST method is the one we shall use.

The ACTION attribute points to the URL that is set up to receive our form when it is submitted by the user. It is worth looking at this URL in more detail. The first part salmon.psy.plym.ac.uk refers to a computer called salmon located in psychology (psy) at plymouth (plym) which is an academic (ac) site in the United Kingdom (uk). The next part cgi-win/polyform.exe points to a program called polyform.exe which resides in the cgi-win subdirectory on salmon. Polyform is a program that executes scripts. Scripts are programs that deal with data sent back by forms that users fill in. The name of the script that processes user input from this questionnaire is called health.
Each questionnaire requires its own script which I will help you set up; you need to decide on a Script Name e.g.
<form method="post" action="http://salmon.psy.plym.ac.uk/cgi-win/polyform.exe/your_Script_Name_goes_here">
Setting up PolyForm is described in more detail below.

But first we need to add a few fields for the user to fill in. To do this use the <INPUT ...> element.
For example, the questionnaire shown above uses two type of input fields: a text field to get information about nationality, and a pair of radio buttons to record the user's gender:

<p>What country do you live in?:<INPUT TYPE="text" NAME="01nationality" VALUE=" ">
<p>Sex
<ul>
<li><INPUT TYPE="radio" NAME="02sex" VALUE="female" >Female
<li><INPUT TYPE="radio" NAME="02sex" VALUE="male" >Male
</ul>

There are only a few attributes we need to worry about right now: There are several TYPES of input fields, all very well described in various HTML tutorials. The ones you need for your questionnaires are called text and radio.

Setting INPUT TYPE ="text" creates a box on the user's screen into which they can type their reply to your question. Their reply is stored in a variable you have defined with the NAME= "your_variable_name_here" attribute.

Setting INPUT TYPE = "radio" creates a radio button that the user can toggle on and off. Normally you use radio buttons in groups of two (as in the example) or more. The button chosen by the user is stored in a variable you have defined with the NAME= "your_variable_name_here" attribute. You decide what value the variable should be using the VALUE tag. In our example the line:
<li><INPUT TYPE="radio" NAME="02sex" VALUE="female" >Female
means that the value of the variable 02sex is set to female if the user selects this radio button.

You may be wondering why each name in our example is in the form "01variable_name", "02variable_name" etc. You should place two digit numbers at the start of variable names so that your data is correctly stored by your PolyForm script. The number must be in the form of two digits i.e. 01,02,.....98,99.

We can now turn our attention to the end of the Form where there are a number of hidden fields

<INPUT TYPE="hidden" NAME="51date" VALUE="pfDate" >
<INPUT TYPE="hidden" NAME="52longdate" VALUE="pfLongDate" >
<INPUT TYPE="hidden" NAME="53time" VALUE="pfTime" >
<INPUT TYPE="hidden" NAME="54TransactionID" VALUE="pfTransactionID" >
<INPUT TYPE="hidden" NAME="55RemoteHost" VALUE="pfRemoteHost" >
<INPUT TYPE="hidden" NAME="56RemoteAddress" VALUE="pfRemoteAddress" >
<INPUT TYPE="hidden" NAME="57Referer" VALUE="pfReferer" >.

Hidden fields, as their name suggests, are hidden from users of your form. You can check this out by loading the form in your browser and scrolling the display to the end of the document. Hidden fields are used to return important information about when and where your data was submitted. Note the form of the VALUE tag e.g. VALUE="pfDate". The characters "pf" tell Polyform to record a specific bit of information, in this case the date the form was submitted. The meanings of the other unique VALUE attributes are described in the PolyForm documentation which is available online from my Home Page at http://otter.psy.plym.ac.uk/PKHomepage.html


We are almost done, we just need to add a way for the user to submit the form. In our example this is done with the line:
<INPUT TYPE="submit" VALUE="Transmit"> completed questionnaire to remote computer.

If you want, you can have a CLEAR button that allows users to discard their answers and start over again. I don't use this facility on long questionnaires because if users hit it by mistake they would loose a lot of work. But it is useful on shorter questionnaires.

We use a modified INPUT element to create "submit" and "clear" buttons. It is pretty much the same old INPUT, but with a different set of TYPE attributes which control what kind of a field it is. We use the submit type to submit the form, and the reset type to clear the form and reset all fields to their default values. The clear button doesn't actually clear the form, it merely resets all the fields to their default values. If the field started out as empty it will be returned to the empty state. However fields starting out with text in them, will have that text restored to them if it has been modified.


<input type="submit" value="Send In This Form">

<input type="reset" value="Clear">

You end a form with the </FORM> element. Don't forget to close your HTML document with the appropriate tags:
</body>
</html>

Where and How are the User's Replies to my Questionnaire Stored?

PolyForm can be setup to store the data provided by users of your questionnaire in a file format that can be imported into Excel ready for data analysis. In addition PolyForm can send you an email containing the user's data and information about where and when the questionnaire was completed.

Setting Up PolyForm to Record Questionnaire Responses


This is a screenshot showing how to setup PolyForm to save data. The meanings of the various entries are explained below the screenshot.

PolyForm setup

You must give your PolyForm script a name; in this example the Script Name is health. The Script Name must correspond to the name in your HTML FORM i.e.
<FORM METHOD="POST" ACTION="http://salmon.psy.plym.ac.uk/cgi-win/polyform.exe/health">

The user's data will be stored in an Output File with the name HEALTH.CSV in the subdirectory C:\WINDOWS\TEMP\ (see screenshot). This file is on the computer running the PolyForm script: salmon.psy.plym.ac.uk. The Output File format is Comma Delimited which means that PolyForm places a comma between each variables value so that each variable is read into a separate cell in the Excel spreadsheet. Note this only works if each variable name begins with two digits (e.g. 01, 02,..... or 99 see above).

The Mail Options section is setup so that every time a user submits the questionnaire Form an email is sent to pkenyon@salmon.plym.ac.uk. This email contains a list showing the user's response to each question. Individual questions are reported as their variable name followed by the users response.

The Object Returned to Client section is set up to return an HTML document called thankyou.htm which is stored on the computer 141.163.90.14 which is another way of referring to salmon.psy.plym.ac.uk (it's the so-called IP (Internet Protocol) address of salmon)

Obviously the details of your PolyForm script will differ from those shown here.


How PolyForm Reports Questionnaire Results: email

Here are two screen shots showing the emails sent by PolyForm.

PolyForm output

The first picture shows the start of the email sent by PolyForm after a remote user has completed the Health Role Beliefs Questionnaire. Note that I use Eudora as my mail client; if you use another program (such as Pegasus) your display may differ. Examine the Subject and from fields. Their contents reflect the entries we made earlier when we set up PolyForm and contain Output of Health Role Beliefs Questionnaire and P Kenyon respectively. The line of information below the heading Notification of Form Submission tells us


the nest three lines tell us that the respondent was a 38 year old female living in America Notice that PolyForm has stripped off the leading digits from variable names before emailing their values; e.g. 01nationality is converted into nationality and 02sex is converted into sex etc.
the subsequent entries tell us the users reply to each question e.g. she chose option 1 in response to question# A1; option 7 in response to question# A2 etc.
The following picture shows the end of the email message produced by the PolyForm script.

PolyForm output
Most of this display is taken up by a list of question numbers and the respondent's choices. Towards the end of the email there is information provided by the "hidden" variables we included in the HTML form. Notice how PolyForm has stripped off the leading "pf" before emailing their values: e.g. "pfDate" is converted into date: 17/03/96 and "pfLongDate" is converted into longdate 17 March 1996 etc.


How PolyForm Reports Questionnaire Results: Excel Files

Here is a screenshot of users' responses stored by PolyForm in a CSV file that has been imported into an Excel spreadsheet.

PolyForm output

The variable names we gave to each question are shown along the top of the spreadsheet: Nationality, sex, age, A1,A2 etc. Note that I have suppressed some of the variables in order to show the "hidden" variables reported by PolyForm. You can use this data to do whatever statistical calculations you want: average age, age range, number of male and female respondents, mean response to each question etc.

Checking the Validity of Data Returned by PolyForm

You should take steps to ensure that the replies to your questionnaire are accurately captured by your PolyForm script.
The following screenshot shows one way of doing this.

PolyForm output

Create a random set of replies to your questionnaire and store them in an Excel spreadsheet. Print these values out and enter them into your questionnaire. Check that what you have entered corresponds with the printout. The screenshot shows you how you can use a formula that compares the two sets of responses to automatically highlight discrepancies. If you have problems consider:

Finally, check what PolyForm records in the CSV file with the email it sends you.
Table of Contents: Part 2