R. Craig Collins >
Web Page Design >
Instructor Notes: Tutorial 6
Instructor Notes: Tutorial 6 © R. Craig Collins, 2005/6
As I have separate 'lecture' material on most of these topics, I will try to avoid duplicating information; but I still want to comment on some of the content :)
Summary, forms are one way of creating interactivity on a web site, instead of only one way communication.
Session 1
While forms allow interactivity, it is beyond the scope of this class
to discuss what is done to a form's content after it is submitted to
the server. Suffice it to say that CGI scripts written in PERL usually do the
processing, and the processing can be as simple as adding a name to a guest
book, or as complex as a shopping cart; but usually what ever is submitted goes
into a database, and there is lots of ugly programming and coding to be done...
hopefully by someone else. In this class, I bypass all of that, and simply show
you how the collected data could be emailed to someone.
Session 1 focuses on input boxes, which can be a text, the larger textarea, radio, or checkbox, to name a few.
Radio buttons are used for one of many selections (checkbox is used for several of many selections). Your text also mentions password controls.
Which radio buttons allow you to choose one of many, another way of doing this for especially long sets of options is a select menu. You can set it so only a line of two displays, but can have available a very long list of choices, and even set a default value.
The book mentions multiple selection options, but requires the user to understand the concept of multiple selection, using the [Control] key as you click.
Note, just as with named bookmark anchors, and a href using named frames as a target, the name= attribute is needed here as well. It is used to identify what value is being input. You might be able to figure out last name and first name, but what is you now have a long list of numbers the user selected. The fifth digit being a 2 means nothing out of context, so the name attribute can let you know the 2 selected was in response to a question on how many doors on your car, etc.
You can also place boxes around certain questions to improve legibility, using fieldset.
Finally, the book gets to text and checkboxes (I don't care for their grouping much :)
Session 3
Once the data is collected the user needs to be able to submit it, and thus
we need to create a button to click on. But we also need to go and modify the
<form> tag in order to know where to send
the info, once that button is clicked. The book discusses the ability to simply
file the information on your computer,
<input type="file" name="filename">
but that doesn't show that forms can actually move the info to a different machine.
So, I prefer, if not actually submitting to a server, at least using the mailto
option. You need to identify the kind of document being sent (similar to doctype)
using the enctype='text/plain".
And one confusing touch at the end of the book; most users know that pressing the tab key will take them to the next field... but you could change the tab order if you wanted... but why?