Click to skip over navigation
 

lecture 9: form principles

<< previous slide

return to lesson 9 index

next slide >>


1. the <form> tag

All forms are enclosed in <form> and </form> tags. The actual boxes and buttons are created by different tags, however - which we will look at on the next two slides - but without the <form> tags, these elements would not appear. This applies whether or not the form is intended to gather information or is purely decorative.

Unlike the vaguely similar <table> or <map> tags, however, lots of other tags can appear between the opening and closing <form> tags. You will almost certainly have cause to include text formatting tags in there, as that's the only way you can put captions on your form elements. The online teaching materials have plenty of examples of forms, almost all of which exhibit this characteristic.

<form> tags also include information which tells the browser how to process the form, but we will deal with that later on. But even decorative forms need them. If you've tried to put a form on your page and it's not appearing, the first thing to check is that both the opening and closing <form> tags are present.

You can put more than one form on a page, but you cannot nest forms.

2. names and values

On several occasions in this course we have had cause to name parts of our web pages. For example, this is how we got image rollovers to work in the previous lecture. The image was named and we could then refer to it by that name from some other part of the page.

The name attribute is also used in forms, but for slightly different reasons. Each "piece" of information collected by the form - each box, that is - is given a name by the page designer. It is then also given a value, but exactly what that value is depends on what the reader of the page has entered into the form.

Say I have a form with two boxes, designed to collect someone's address and telephone number. I could name the two boxes "address" and "phone". The reader would then assign values to these names: i.e. their actual address and phone number.

However, sometimes you don't give readers a completely free choice in what they can enter. As we'll see, you may get them to select from a "menu" of options, in various ways. In that case, you "preassign" values to the different options, although the final selection of the value still depends on what option they actually select.

All of this will probably make more sense once we've seen some input types, but keep the ideas of name and value in mind, as it will probably help explain what these attributes are doing when you see them.




<< previous slide

return to lesson 9 index

next slide >>