next up previous contents
Next: Password Up: Entering Data Previous: The Submit Button

PLEASE NOTE

These lecture notes are here for archival reasons. I no longer teach Perl.

As such some of the latest Perl innovations are not present. The notes refer to Perl 5.001

Nonetheless, I still believe that this is a valuable resource.

Latest Perl Version and Further Up-to-date Information

The latest stable release of Perl is 5.20 – for example, it doesn't have CGI built-in anymore.

Detail on more modern Perl maybe found at:


Text Input

A text input is simply a box in which anything can be typed -- letters, numbers, or anything else -- via the keyboard. In most browsers, the box is twenty characters wide, but this can vary.

Simply set the type attribute of the input tag to get a text input box:

<INPUT type="text">

which would result result in:

The SIZE attribute can be used to fix the width of the displayed box:

<INPUT type="text" size=9>

which would result result in:

You can limit the number of characters which may be input by using the MAXLENGTH attribute. The value of MAXLENGTH is expressed as a number of characters, just as SIZE is. For Example:

<INPUT type="text" name="socsec" size=9 maxlength=9>

which creates an input field nine characters wide into which no more than nine characters may be input.

or

<INPUT type="text" name="socsec" size=9 maxlength=11>

which creates an input field is still nine characters wide, but the user can enter up to eleven characters.



dave@cs.cf.ac.uk