HTML Forms Part 1
syllabus | schedule | assignments | Web Resources | ARTC courses
[Intro]     [Tags]     [CSSStyles]     [Lists]     [Links]     [ImageTypes]     [Optimization]    [GlobalCSS]     [CSSBackgrounds]
[Tables]     [Slices]     [IR Rollovers]     [Animated GIFs]     [JS Rollovers]     [CSS Margins]     [Windows]     [Video]     [Metatags]     [Imagemaps]     [FormInput]     [FormAtttributes]    [AdvancedForms]    [WhatisJavaScript]    [Windows2]    [Windows3]    [BrowserInfo]    [StatusBar]    [Alerts]    [Randomness]    [Frames]    [iFrames]    [Frames2]   
Forms add interactivity to your site and are made up of text boxes, check boxes, radio buttons, drop-down lists, and other input fields. Forms can interact with CGI scripts to collect and record data.

Form tags can be placed anywhere in the BODY of your html doc:




Even if you just want to substitute a text or image link with a type of Form input, you will still need to use the form tags. In other words, all input tags, select tags, and textarea tags must be contained within a FORM tag.

INPUT tags are the primary tag used in FORMs. The input tag allows your readers to input data to your Web server.

There are ten specific types of INPUT tag:

1. button
2. checkbox
3. file
4. hidden
5. image
6. password
7. radio
8. reset
9. submit
10. text

You choose which type of input tag you would like by placing it in the type=" " attribute.

<input type="button" value="button" name="button" />
The button input type allows you to create custom input buttons that do not have the default effects of the submit and reset buttons. It is most commonly used with JavaScript forms with the onClick attribute so that data is not sent to the Web server until the JavaScript has processed it. This field is blank by default.
If you want it to say something, use the VALUE="" attribute.

<input type="checkbox" /> With a checkbox element, you can give your readers a list of items to choose from. They can choose more than one in the list. Or it can be used as a "yes/no" toggle, when there is only one option. If you have a group of checkboxes, link them all together by giving them the same name. The values will all be sent to the form separately.

<input type="file" />
The file input type allows your readers to upload a file to your Web server.

<input type="hidden" />
Hidden fields are used to "save state" within an HTML form. They are most often used in forms that have multiple pages and information that needs to be carried from one page to the next. They are not shown on the Web page, but the information is sent along with other form input fields.

<input type="image" name="my_image" src="../images/pixel.jpg" border="0" />

With the image input type, you have yet another option for a button on your forms. You can use any image as a button on your forms. One thing to note, images as submit buttons don't allow for the tab key to move the focus to it, and this makes them less accessible for people with no mouse.

<input type="password" name="myPassword" value="enter password"/>
The password field looks almost identical to the text field. However, when you type in it, the letters are hidden. This allows you to have a little more security for passwords on your forms. Remember, however, that the passwords are not sent encrypted in any way. So don't rely on this to secure truly important secret information.

enter password

<input name="myRadio" type="radio" value="lettuce" />
Radio buttons give readers a "one of many" choice combination. Like the checkbox input type, radio button groupings all have the same NAME, and each value is different. If a reader chooses one value, all the other values will be deselected.


<input type="reset" name="myReset">
The reset button resets the form to its default value. With most forms, this is blank entries, but if the fields have starting values, the reset button will return the form to that. This "resetting" is done by the browser, not the server. This button will have the default value of "Reset", if you want it to say something different, change the VALUE="" attribute.

<input type="submit" name="mySubmit">
In order for a form to be sent to the server it needs some form of submit button. This field sends the form information to the Web server when it is clicked. In Internet Explorer it has a default value of "Submit" and in Netscape of "Submit Query". If you want to change this, change the VALUE="" attribute.

<input name="myText" type="text" size="20" maxlength="20">enter text
<textarea name="myTextArea" cols="20">enter text</textarea>

The text box is the most common input type and to make HTML easier, is the default for the INPUT tag. This input element allows your readers to type in any text information into the box.

single line