Web Page Basics

Basic Interactivity

Interactivity

Basic interactivity can be developed using the HTML forms module. Forms enable you to elicit information from your users. It also introduces you to another aspect of web development: simple scripts.

It is important for you to understand the rudimentary issues of form development to complete your understanding of Web coding.

 

Online Forms

What do you know?
In your Learning Journal write down when you have used an online form and any frustrations you encountered.

 

Building Forms

To create a form you need to know about 2 major components:

Your text discusses a processing script called CGI (Common Gateway Interface) which takes information and processes the information collected into a format that you can use. While CGI's are very powerful, they require scripts to be placed on the web server and are beyond the resources of this unit. You will focus on building forms that collect and send data via email. However, the CGI discussion will be reffered to at the end of this topic.

Organising information
Whether you are using email processing or CGI, before you can build your form, you need to have some idea of what information you are going to collect and how this an be organised.

Castro - your set text

Your text, Castro, demonstates this very clearly in the first few figures of the chapter. Read Figures 16.1 - 16.4 to understand the following terminology:

  • Label
  • Name
  • Value.

Activity: Organising Data

Part of a form
A form has three parts:

View the form in the activity to identify the parts listed above.

Activity: Parts of a Form

Creating a simple form

Use the following scenario to create your first form:

Create an online form that enables you to order a new bed online. Collect the following information from your users:

Personal details:
name, address include city, postcode and state, customer password.

Bed details:
Timber - Mahogany, Maple, Pine, Bamboo
Size - King, Queen, King Single, Single
Extras - footboard, storage drawers, casters, squeak proofing.

Castro - your set textTo work through this scenario, please read your Castro text, Chapter 16, pp. 269-278 and 282-285 and create an (X)HTML file.

Activity: Compare code

Styling your form
Use your knowledge of style sheets to format your form so that users will find it easy to fill in. Use an external style sheet.

To help you get started use the emailform.html as this code already has some structural tags included to enable styling.

Castro - your set textUse your Castro text, Chapter 14, if you need to refresh your memory.

Activity: Forms with style

Other form elements
Castro - your set textCastro text also provides guidance on how to use a range of other features in a form including:

  • Allowing visitors to upload files p. 279
  • Use of hidden fields p. 280-281
  • Using an image to submit data p. 286.

Work through these pages if you think these features would be useful to your forms.

Organising form elements
Forms can be a difficult element for users to figure out how to use on a site. There are a number of inbuilt coding practices that can help your users out.

Castro - your set textCastro, Chapter 16, pp. 287-292 describes how some of these can be used:

  • Use of <fieldset> and <legend> elements to group like information (p.287)
  • Formally labelling parts using <label> element (p. 288)
  • Setting the table order of a form to make the different entries easily selectable without using a mouse (p. 289)
  • Adding Keyboard shortcuts (p. 290).

The use of the tab order and other grouping of like information are particularly important to help users readily submit data you are collecting.

Activity: Tab Order & Shortcuts

Building Usable Forms

Creating forms that are easy for people to use is always a challenge. There has been a great deal of research on how to go about creating user friendly forms.

reading Reading 18, Chapter 13, pp. 111-n129 is a chapter called Screen-based controls (Widgets). While this general relevance to all screen based controls, many of these are found in forms used in web pages.

Some of the issues include:

Activity: Usable Form

CGI Scripts

As indicated earlier, CGI scripts provide a more sophisticated means for processing data collected by a form.

Castro - your set textCastro, Chapter 16, pp. 263-268 provides a comprehensive introduction to this topic. If you are interested in CGI functionality, your text explains:

  • what CGI scripts are and how they can be used;
  • security issues associated with CGI's;
  • how to prepare a script.

Castro also provides resources for CGI:

Putting it into practice

Create an online survey

Create an online survey that requires users to provide information regarding their operation systems. The title bar should display Operating Systems Survey by Your Name. Form results should be sent to your email account.

Use the files below:

download survey.html (2.34k)
download survey.css (490 bytes)

The form should contain the following:

  • A text box to accept the person's name and email address.
  • Check boxes with Name and Value attributes for these operating systems:
    • Macintosh OS
    • Windows 2000
    • Windows 98
    • Windows XP
    • Unix
  • Radio buttons with Name and Value attributes that correspond to the operating systems above that will allow the user to rate the systems as follows:
    • Good
    • Bad
    • Never used it
  • Submit control
  • Reset control.

Create an associated style sheet to ensure that your form is use friendly.

Check answers

Create a complaint form

Create an HTML form that can be used to gather complaints online. I will leave it up to your imagination where an appropriate deployment may be!

Your form results should be sent to your email account. When you have created the form, style it so that it is user friendly.

Your form should contain at least the following - your creativity is also encouraged:

  1. Text boxes to accept the person's name and email address.
  2. Text area for complaint.
  3. Radio buttons with Name and Value attributes for these options
    1. I just wanted to know
    2. please respond to the email address given
    3. contact my lawyer
    4. Go to #!$#*!
  4. Text boxes to accept the lawyer's name and address
  5. Submit control
  6. Reset control

Post your table as an attachment to the discussion forum.

Note:

  1. any difficulties that you have had in creating this table.
  2. difference between both browsers in their displays.

What have you learned?
This topic introduced you to the basics of HTML interactivity using forms.

  1. What are some of the basic techniques for organising information in a form?
  2. What are three usability issues that you should be aware of when using forms?

Next section Site Development