lesson 1 [introduction, basic html]
lesson 2 [formatting text, colouring text and background]
lesson 3 [images
lesson 4 [lists]
lesson 5 [tables]
lesson 6 [links, imagemaps]
lesson 7 [frames]
lesson 8 [microsoftisms, netscapisms]
lesson 9 [forms]

lesson 9 - let's get a response - [13 - forms]
homecommentmore downloadsdownload this

Forms allow the viewer of your page to respond. They can be used for almost anything you can imagine. Think of the amount of forms we use in everyday life, why should the internet be any different?
    A common use of forms on the web is to get feed-back on your page. Who was there? What did they think of it? etc. etc.
    After this lesson you will add a form like this to your html builder.

 

<!--13 Forms-->

In this chapter you will learn about the different form fields i.e. the different ways the viewer can fill in your form. You will learn how to use these in your forms and how to receive your form results by e-mail. There are other ways in which you can receive your form results but they require a knowledge of CGI scripts.

please comment when you're finished

You should note that the mailto forms taught in this tutorial will not work with Internet Explorer 3/3.01. I was not aware of this at first writing but have become aware of it thanks to the help of Steve Everhardt.

Thanks Steve

get me started

The start tag of a form is <form> and </form> is the end tag. The attributes set in the <form> tag are very important. Here is the completed tag:

<form action= "mailto:me@myhouse.com" method=post>

If you were using CGI scripts to handle your form the action attribute would lead to the URL of the script and method could be set to get. These do not matter to you though. If adding a form to your page set the same attributes as the above tag but obviously use your own e-mail address.

The next step is to customise your forms so as you will get the information you want from your viewers but also present it in the best possible way.

<textarea>

Textareas provide a space for the viewer to enter comments etc. There are three attributes of the <textarea> tag. They are name, rows and cols.

<textarea name= "comments" rows=4 cols=40>

name assigns a name to your textarea

rows sets the height of your area by the amount of rows of text will be visible at a time

cols sets the width of your area in characters

Therefore the above tag will produce a text box named comments which displays 4 lines of text with 40 characters on each line.

The <textarea> tag requires a </textarea> tag. Any text between these tags will appear in the text box when the form is loaded.

How will this look in my browser?

The listing in Notepad Viewer 13.1 displays as Explorer View 13.1 in Internet Explorer 4.

Notepad Viewer 13.1

<html>
<body>
<form>
comments<br>
<textarea name="feedback" rows=4 cols=40 >
enter your comments here
</textarea>
</form>
</body>
</html>

please comment when you're finished

 

 

I would like ot thank Eugene Bielinski for his help with these tutorials. Eugene while reading my tutorial sent me continuous messages about spelling mistakes he had found. I hope I have manages to correct most of them!

Thanks Eugene

 

 

 

 

Thanks to Nicolas Dupont who suggested that I make the new text in the html builders bold. What a great idea!

Thanks Nicolas

You will learn more about the "name=" attribute after this explorer view.

Explorer View 13.1 - click on the image to see a bigger and clearer version

select lists

Select lists are used in multiple choice situations. The choices can appear in a list or in a drop down menu. See Explorer View 13.2.

Explorer View 13.2 - click on the image to see a bigger and clearer version

  • When the arrow is clicked, a list similar to the scrolling list will drop down.

Here is the corresponding Notepad Viewer:

Notepad Viewer 13.2

<html>
<body>
<form>
this is a scrolling list
<select size=4 name= "select1">
<option value="1" >one
<option value="2" >two
<option value="3" >three
<option value="4" >four
</select>
this is a drop down list
<select name= "select2">
<option value="1" selected>one
<option value="2" >two
<option value="3" >three
<option value="4" >four
</select>
</form>
</body>
</html>

please comment when you're finished

 

 

Thanks to Candy Burts for suggesting that the links in the images should open new browser windows. That was a fantastic idea.

Thanks Candy

As you can see both types were created with the same code except for one difference. The drop-down list does not specify the amount of choices there will be. If you want your select box to appear as a drop down box, don’t include the "size=" attribute. I will now explain all the tags and attributes.

TAGS

<select> signals the start of a list of options to appear in a select box

<option> has no end tag; signals the start of one of the options; must be

within the <select> and </select> tags

ATTRIBUTES

<select name= "choose1" size=4 multiple>

name assigns a name to the box, which will be used in the e-mail you

receive

size if set the select box will be a scrolling box, sets the amount of

options there will be

multiple if set the viewer will be able to choose more than one option by

holding down "ctrl" when choosing, the box will then always

appear as a scrolling list.

<option value= "type1" selected>

value sets what will appear after the name of the select box in the e-mail

selected if set then this option will already be selected when the form is

opened

If you are confused about the name and value attributes do not worry. all will be explained later on

Note: the text that you want displayed for the option should be displayed after the option tag and before the next one or in the case of the last option before the </select> tag.

input types
text

This is what as input text box looks like

Here is the completed tag:

<input type="text" name="e-mail" size=30 value="you@server.com" maxlength=50>

name sets the name that will appear on the e-mail

size sets the width of the box in characters

value sets the default text

maxlength sets the maximum amount of characters allowed in the box

 

password

The attributes are the same and it is displayed the same except that the text which is typed in appears as a number of asterisks i.e. ***********. To use password boxes set type to "password".

please comment when you're finished

checkbox

A checkbox appears as a square box, if it is checked the box has a tick in it. It is very simple to use. This is the full tag:

<input type="checkbox" name="check" value="yes" checked>

name sets the name that will appear in the e-mail

value if the box is checked the value appears beside the name in the

e-mail

checked if this is set then the box will already be checked when it is loaded

radio

Radio boxes appear in groups of two or more, only one of them can be checked. They are commonly used for yes or no questions. Although they usually appear in groups, corresponding radio boxes do not have to be next to each other. All radio boxes within the <form> and </form> tags with the same name are treated as a group. By this I mean that only one of them can be checked. Here is a completed radio tag:

<input type="radio" name="decision" value="yes" checked>

name sets the name that will appear in the e-mail

value if this box is checked this value will appear next to the name in the

e-mail

checked if this is set then this radio box will be checked when the page is

loaded

You might have been confused by the opening paragraph that spoke about radio boxes scattered around the page. Hopefully this Notepad Viewer and corresponding Explorer View will help you understand.

Notepad Viewer 13.3

<html>
<body>
<form>
<b><br><input type="radio" name="which one" value="sandwich">Sandwich</b>
<br><input type="radio" name="what filling" value="sh">with ham
<br><input type="radio" name="what filling" value="sc">with cheese
<br><input type="radio" name="what filling" value="shc">with ham and cheese
<b><br><input type="radio" name="which one" value="roll">Roll</b>
<br><input type="radio" name="what filling" value="rh">with ham
<br><input type="radio" name="what filling" value="rc">with cheese
<br><input type="radio" name="what filling" value="rhc">with ham and cheese
</form>
</body>
</html>

The viewer of this collection of radio boxes will tick a maximum of two boxes because there are only two different names. It is however possible that s/he will forget to tick one of the collections. We can avoid having empty fields sent back to us by adding a "checked" attribute to one of the boxes.

Explorer View 13.3 - click on the image to get a bigger and clearer version

One of the checks will be next to either "Sandwich" or "Roll" the other will be next to one of the other six lines of text.

reset

This appears as a button. When the button is pressed all of the entry fields in the form are cleared or returned to their defaults.

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

value can be used to edit the text that appears on the button

please comment when you're finished

submit

This also appears as a button. When it is pressed the information in the form is sent to the e-mail address specified in the <form> tag. If there is a URL of a CGI script set in the <form> tag then this button, when pressed tells the browser to load that URL.

<input type="submit" value="Send the form">

value can be used to edit the text that appears on the button

What will my e-mail look like?

You now know all of the different ways you can let your viewer give you information. But what will that information look like when presented in the e-mail?

The information will be received as an attachment with an e-mail. You can open this attachment in any text editor or even with your browser.

To show you what it will look like I will fill out a sample form, e-mail it to myself and then copy and paste the text in the attachment into this book. Firstly though I will show you the Notepad Viewer and Explorer View of the form.

Notepad Viewer 13.3

<html>
<body>
<form action="mailto:html3.2@technologist.com" method="post">
Enter text into this textarea.<br>
<textarea cols=40 rows=4 name="textarea">
</textarea><br>
Now choose from my select list
<select name="select">
<option selected value="option1">First Option
<option value="option2">Second Option
<option value="option3">Third Option
</select><br>
What is your name?<input type="text" size=20 maxlenght=50 name="inputtext"><br>
What is your password?<input type="password" name="password" size=10><br>
Check the boxes next to the foods you like.<br>
<input type="checkbox" name="pizza" value="yes">Pizza<br>
<input type="checkbox" name="potato" value="yes">Potato<br>
<input type="checkbox" name="pasta" value="yes">Pasta<br>
Do you like milk?<br>
Yes<input type="radio" name="milk" value="yes" checked> or no<input type="radio" name="milk" value="no"><br>
<input type="reset" value="Clear It"><input type="submit" value="Send it">
</form>
</body>
</html>
please comment when you're finished

This is what the form looked like before I filled it in:(click to see a bigger and clearer vrsion)

And this is what it looked like after I filled it in: (click on the image to see a bigger and clearer version)

This is how data was presented in the e-mail.

Notepad Viewer- Resulting E-mail

textarea=This+is+the+text+that+appears
+in+the+textarea&

select=option2&

inputtext=Oisin+Prendiville&

password=anois&

pizza=yes&

pasta=yes&

milk=yes

  • all of the text was originally on one line with no spaces but I placed each individual part on its own line
  • remember this is attached to the e-mail it is not the actual e-mail

There are many characters that will not present properly in the e-mail (we already know that spaces present as +). Here is a table displaying those characters and the way they are presented in the attachment.

lesson 1 [introduction, basic html]
lesson 2 [formatting text, colouring text and background]
lesson 3 [images
lesson 4 [lists]
lesson 5 [tables]
lesson 6 [links, imagemaps]
lesson 7 [frames]
lesson 8 [microsoftisms, netscapisms]
lesson 9 [forms]
1 2 3 etc.   same
a b c etc.   same
!   %21
"   %22
£   %A3
$   %24
%   %25
^   %5E
&   %26
*   same
(   %28
)   %29
_   same
-   same
+   %2B
=   %3D
{   %7B
[   %5B
}   %7D
]   %5D
:   %3A
;   %3B
@   same
'   %27
~   %7E
#   %23
<   %3C
,   %2C
>   %3E
.   same
?   %3F
/   %2F
|   %7C
\   %5C


home    comment    more downloads    download this
lesson 1 [introduction, basic html]
lesson 2 [formatting text, colouring text and background]
lesson 3 [images
lesson 4 [lists]
lesson 5 [tables]
lesson 6 [links, imagemaps]
lesson 7 [frames]
lesson 8 [microsoftisms, netscapisms]
lesson 9 [forms]

HTML Builder- End of Lesson 9

The first document you must create is "form.html". This is what it looks like.

Notepad Viewer- HTML Builder 9.1(form.html)

<html>

<body bgcolor=black text=fuchsia>

<h2>Please send me your comments</h2>

<form action="mailto:youremail@server.com" method=post>

Please tell me your name<input type="text" name="name" size=30 value="type here"><br>

and your e-mail<input type="text" name="email" size=40 value="you@server.com"><br>

Please comment on the presentation and content of my page<br>

<textarea name="comments" rows=4 cols=50>Comment Here</textarea><br>

Please tell me how you found my site?

<select name="howfind">

<option selected value="yahoo">From Yahoo

<option value="othersearch">From another search engine

<option value="link">A link on another site

<option value="friend">A friend told me the address

<option value="other">Other

</select><br>

Which Search engines do you use regularly?<br>

Yahoo<input type=checkbox name="yahoo" value="yes">

Lycos<input type=checkbox name="Lycos" value="yes">

AltaVista<input type=checkbox name="AltaV" value="yes">

Webcrawler <input type=checkbox name="Crawler" value="yes">

Excite <input type=checkbox name="Excite" value="yes">

Other<input type=checkbox name="Other" value="yes"><input type=text name="specify"value="If Other please specify"><br>

Will you be visiting my page again? Yes<input type="radio" name="back" value="yes"> <i>or</i> No<input type="radio" name="back" value="no"><p>

<input type="reset" value="Clear that form!"><input type="submit" value="Gimme the form">

</form>

</body>

</html>

The anchor for this will be placed in "builder.html" along with the paragraph about the lesson. Please add this to the end of "builder.html".

Notepad Viewer- HTML Builder 9.2(builder.html)

<hr size=3 width=75% color=lime align=left>

<a name="lesson9"><h2>This is what I have learned from lesson 9</h2></a><img src="talk.gif" height=80 width=80 alt="talking man" hspace=40>

<hr size=3 width=75% color=lime align=left>

<a href="detailed.html#top"><i><font color=red>back to contents</i></a></font><p>

Lesson 9 was all about creating forms. Forms allow the viewer of the page to interact with the designer. There are six different types of entry fields. They are textareas, select boxes, text input boxes, password input boxes, checkboxes and radio boxes. Most forms will also contain a reset button and a submit button. Click <a href="form.html" target="_self">here</a> to see the form I created.

An anchor to the paragraph must now be placed in "menu.html" and in "detailed.html". This is what the anchor in "menu.html" looks like:

<a href="builder.html#lesson9" target="window">Lesson 9</a>

This is the new list item I want you to add to "detailed.html":

<li><a href="builder.html#lesson9" title="Paragraph about what I learned from Lesson 9">Lesson 9</a>

<ul type=circle>

<li>Creating forms

<li>Textareas

<li>Select boxes

<li>Input fields

</ul>

Finally we should add a title to "index.html":

<head>

<title>I now completely Understand HTML 3.2</title>

</head>

 

It’s all over (or is it?)

So that’s it, you’ve reached the end of the book, the peek of the mountain but is it really the end? I think not. This is the beginning of your web publishing days. It is now time for you to leave the real world (which can be boring at times) and venture out into a place we call the Web. Make sure to use all your newly acquired skills as you prepare to inform the Web of your presence. Don’t forget to make your page interesting, please!

Please send me your comments and ideas, after all you did get the book for free.

Please tell me what you think
name

email

website

comments





 


home    comment    more downloads    download this


Information
The official home-page where this document can be downloaded is http://www.geocities.com/SiliconValley/Network/4759/
This document (whole or part) is not to be used, plagiarised, or its' content attributed to any other author. Any quotes must be acknowledged to the author and the author must be informed of the quotation before it's publication. This is effective whether the quotation is being transmitted by electronic or any other means. The author of this document is Oisin Prendiville who can be contacted at
html3.2@technologist.com

This document was last modified by the author (above) on 5/12/1998
© copyright 1998