Home : Topics : Forms and dynamic sites : Form controls
Form controls
Submitting forms
Processing submissions
< Previous: Introduction

Form controls

Forms are included in a <form> tag, and made up of standard GUI controls. Each control is given a name, which identifies the data from that control when it is returned to the server.

<form> tag

All form controls should be contained within a form tag. The form tag specifies where a form will be sent when it is submitted, and groups controls. All the controls within one form tag are considered to be part of that form; you can have multiple forms on a page if you want, using different form tags.

Checkboxes (<input type="checkbox">)

These are small squares; clicking the mouse on them places or removes a tick mark. Checkboxes are used when the user has to make an 'on/off' decision.

Radio buttons (<input type="radio">)

These are small circles in groups; clicking on a radio button makes that radio button selected, and all the others in the group unselected. Radio buttons are used when the user has to pick a single option from a small number of choices.

Drop-down lists (<select>)

These controls show the currently-selected option, with a downwards triangle to indicate that more are available. Clicking on the option brings up a (scrollable) list of all available options, from which the user can pick. Drop-down lists are appropriate when the user has to pick a single option from many options.

Text fields (<input type="text">)

Text fields allow the user to enter a single line of text. This would be appropriate, for example, if you wished to query the user's name.

Text areas (<textarea>)

Text areas allow the user to enter multiple lines of text. For example, you would use a text area if you wanted to allow the user to write a general comment about your site, as this might be more than one line long.

Submit buttons (<input type="submit">)

The user clicks on a submit button when they have finished editing the form; the data is then sent to the server.

Graphics (<input type="image">)

Graphics can be used instead of submit buttons.

In this case, the co-ordinates within the graphic on which the user clicked are returned, so that you could (for example) allow the user to click on a map and then show them a zoomed-in version of the area in which they clicked.