You are here:  NetStrider » Tutorials » HTMLRef » Commands » INPUT «

HTML Reference Guide

Author: Randy D. Ralph.   In place March 1, 1999.   Copyright © 1999 NetStrider.   Presented as a public service.

BACK <INPUT> Command next

Command Syntax:

<INPUT command parameters>

Defines a data input field within a <FORM> in any one of several types as defined below.

See also:  <FORM>.

Command Parameters:

align="left|right|top|middle|bottom"

This parameter uses the same values as does the <IMG> command, however, precise alignment of form elements is best accomplished using tables.


checked

This parameter requires no value.  It indicates that if the form element is a radio button or a check box it is preselected as the default in a defined list of options.


maxlength="# of characters"

Defines the maximum response length, in characters, that is allowed for input in a text box.


name="input element name"

Provides the defined input element with a name.  The name should be unique within the form.


size="# of characters"

Defines the display width of a text input element in characters.  Input is allowed beyond the size of the input box, but cannot exceed any set maxlength.  Long input simply scrolls the content of the box toward the left so that the user can see what is being keyed.

src="URL"

Defines the URL of an image to place in a form only where type is image.


type="input type"

Where input type can be any from the list of predefined types below:

  • checkbox -
    declares the input type to be a checkbox

  • hidden -
    declares the input type to be hidden from the user's view
    useful for using the form to send identifying information back to the server

  • image -
    places an image in the form for use as an alternative to the standard submit button

  • password -
    declares a text type box, but the input is not displayed as it is keyed

  • radio -
    declares the input type to be a radio button

  • reset -
    defines a form reset or clear button

  • submit -
    defines a form submit button

  • text -
    declares the input type to be simple text

  • textarea -
    declares the input type to be a text block area capable of receiving a large block of input text.

    Use the more advanced <TEXTAREA> command instead.


value="default value"

Establishes a default value in any defined input element.  Radio buttons require values to permit selection.
 

Examples:
<INPUT type="checkbox" name="pick" value="First" checked>First<br> <INPUT type="checkbox" name="pick" value="Second">Second<br> <INPUT type="checkbox" name="pick" value="Third">Third<br> <INPUT type="checkbox" name="pick" value="Fourth">Fourth Yields -

First
Second
Third
Fourth
All defined checkboxes share the same name but represent different values.

When the form is submitted, only the values corresponding to the checked boxes are transmitted to the server.

Checkbox selections are not mutually exclusive.


<INPUT type="hidden" name="return_address" value="Randy_Ralph@uncg.edu"> Produces no visible display within the form but instructs the server that the return_address value is Randy_Ralph@uncg.edu.

<INPUT type="image" src="../images/submit.gif" tppabs="http://www.netstrider.com/tutorials/HTMLRef/images/submit.gif" name="submit" align="middle" border=0> Yields -

A placed image as a clickable submit button.

The image placement takes the same command parameters as the <IMG> command.


Language:<br> <INPUT type="radio" value="Danish" name="language" checked> Danish<br> <INPUT type="radio" value="Icelandic" name="language"> Icelandic<br> <INPUT type="radio" value="Norwegian" name="language"> Norwegian<br> <INPUT type="radio" value="Swedish" name="language"> Swedish Yields -
Language:
Danish
Icelandic
Norwegian
Swedish

An array of radio button choices.  Try selecting a different choice from the preselection Danish.

All defined radio buttons share the same name but represent different values.

When the form is submitted, only the value corresponding to the selected radio button choice is transmitted to the server.

Radio button selections are mutually exclusive.


<INPUT type="reset" value=" Clear "> <INPUT type="submit" value=" Submit "> Yields -
Standard reset and submit buttons which display the text set as the value.  The reset button clears form content.  The submit button sends the form content to the host server using the proscribed method and action.

Name: <INPUT type="text" name="name" size=40><br> Address: <INPUT type="text" name="address" size=40><br> City: <INPUT type="text" name="address" size=14> State: <INPUT type="text" name="address" maxlength=2 size=2> Zip: <INPUT type="text" name="address" maxlength=5 size=5> Yields -
Name:
Address:
City: State: Zip:

Each text field defined is independent of all others so long as the field name is unique to the form.  Maxlength parameters are set on State and Zip to control input length.

Much tighter and more precise control over placement of form text input fields can be achieved if they are arranged in tables.

See also:  <TEXTAREA>

Return to Section I:L


Return to the List of Commands
Author: Randy D. Ralph.  In place March 1, 1999.  Copyright © 1999 NetStrider.  World Rights reserved.




Hosted by uCoz