W3 3.2y
4.0y
NS 3.0y
4.0y
IE 3.0y
4.0y
TV 1.2y
2.1y

<INPUT>

Description

<Related pages>
* Information about an add-on to add support for <INPUT type="file"> to IE 3.02
* RFC 1867.
Create a control for a form. A control is an element which the user can use to enter data, like textboxes, radiobuttons and checkboxes. This element is only valid inside the FORM element.

DTD

<!ELEMENT INPUT - O EMPTY              -- form control -->
<!ATTLIST INPUT
  %attrs;                              -- %coreattrs, %i18n, %events --
  type        %InputType;    TEXT      -- what kind of widget is needed --
  name        CDATA          #IMPLIED  -- submit as part of form --
  value       CDATA          #IMPLIED  -- required for radio and checkboxes --
  checked     (checked)      #IMPLIED  -- for radio buttons and check boxes --
  disabled    (disabled)     #IMPLIED  -- unavailable in this context --
  readonly    (readonly)     #IMPLIED  -- for text and passwd --
  size        CDATA          #IMPLIED  -- specific to each type of field --
  maxlength   NUMBER         #IMPLIED  -- max chars for text fields --
  src         %URI;          #IMPLIED  -- for fields with images --
  alt         CDATA          #IMPLIED  -- short description --
  usemap      %URI;          #IMPLIED  -- use client-side image map --
  tabindex    NUMBER         #IMPLIED  -- position in tabbing order --
  accesskey   %Character;    #IMPLIED  -- accessibility key character --
  onfocus     %Script;       #IMPLIED  -- the element got the focus --
  onblur      %Script;       #IMPLIED  -- the element lost the focus --
  onselect    %Script;       #IMPLIED  -- some text was selected --
  onchange    %Script;       #IMPLIED  -- the element value was changed --
  accept      %ContentTypes; #IMPLIED  -- list of MIME types for file upload --
  >
from the HTML 4.0 DTD, "Copyright © W3C, (MIT, INRIA, Keio). All Rights Reserved."

Attributes

Core attributes: class id style title
Internationalization attributes: dir lang
Events: onclick ondblclick onmousedown onmouseup onmouseover onmousemove onmouseout onkeypress onkeydown onkeyup

W3 3.2y
4.0y
NS 3.0y
4.0y
IE 3.0y
4.0y
TV 1.2y
2.1y
TYPE
Because the most attributes for this element depend on the type of control I first list the attributes that apply to all the controls that can be created. Then I list the attributes that are specific attributes, per type.

Value Description
BUTTON Creates a button. The action that is triggered by using this button is defined by the ONCLICK attribute.

This value is not supported by the HTML 3.2 Reference Specification.

CHECKBOX Creates a checkbox. This can be used for simple Boolean attributes, or for attributes that can take multiple values at the same time. The latter is represented by several checkbox fields with the same name and a different value attribute. Each checked checkbox generates a separate name/value pair in the submitted data, even if this results in duplicate names.
FILE This provides a means for users to attach a file to the form's contents. For this TYPE the value the user enters is not send to the server but this value is used as the filename of the file that is send instead.

For this input type to function correct you must specify enctype="multipart/form-data" because the data send to the server consists or more than one part.

Complete information can be found in RFC 1867.

Note: Internet Explorer 3.0 only supports this from version 3.02, and there must be an add-on installed.

HIDDEN These fields provide a means for servers to store state information with a form. This will be passed back to the server when the form is submitted, using the name/value pair defined by the corresponding attributes.
This is a work around for the statelessness of HTTP. Another approach is to use HTTP "Cookies".

The need to store information between pages exists because the HTTP protocol is a "stateless" protocol. This means there is no permanent connection between the browser and the server. Each time the browser requests a page, or an element on it, a new connection is made, the data is sent and the connection is closed.

IMAGE Create a graphical submit button rendered by an image rather than a text string. The x and y values of the location clicked are passed to the server: In the submitted data, image fields are included as two name/value pairs. The names are derived by taking the name of the field and appending ".x" for the x value, and ".y" for the y value.
PASSWORD Create a single line text field which will not show the contents of the field but instead the * character.
RADIO Creates a radio button. This can be used for attributes which can take a single value from a set of alternatives. Each radio button field in the group should be given the same name. Radio buttons require an explicit value attribute. Only the checked radio button in the group generates a name/value pair in the submitted data.
RESET Creates a button that users can click to reset form fields to their initial state when the document was first loaded. Reset buttons are never sent as part of the form's contents.
SUBMIT Creates a button that users can click to submit the form's contents to the server. If the name attribute is given then the submit button's name/value pair will be included in the submitted data. You can include several submit buttons in the form.
TEXT Creates a single line text field.

The default type is TEXT.

Supported attributes for every input type
  TYPE=
button checkbox file hidden image password radio reset submit text
A
T
T
R
I
B
U
T
E
action x x x   x x x x x x
accept     x              
align         x          
checked   x         x      
maxlength           x       x
name x x x x x x x x x x
noargs x x x   x x x x x x
nohighlight           x       x
onblur     x     x       x
onchange     x     x       x
onclick x x         x x x  
onfocus     x     x       x
submitform x x x   x x x x x x
size           x       x
src         x          
value x x   x   x x x x x
width x x x   x x x x x x


W3 3.2n
4.0n
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2y
2.1n
ACTION
Use the action attribute to specify the action used when the viewer selects the control. This action overrides the action set in the FORM element and also immediately sends the value for the control to the server without the values for the rest of the form.

The default value for a control is 0. Use the value attribute for the control to set a different value.

When both the action and submitform attributes are set for the control, the WebTV interface submits the entire form by means of this action. Note that the action attribute can also be used to invoke client functions. However, client functions are not recommended for content developers. These functions are intended for use by WebTV Networks for developing basic WebTV functionality.


W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2n
2.1n
ACCEPT
This attribute is used with type="FILE" to restrict the kinds of files allowed to attach to those matching a comma separated list of MIME content types given with the ACCEPT attribute e.g. accept="image/*" restricts files to images.
W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2n
2.1n
ACCESSKEY
Description of the accesskey attribute
W3 3.2y
4.0d
NS 3.0y
4.0y
IE 3.0n
4.0y
TV 1.2y
2.1y
ALIGN
This attribute can be used with type="image" to specify how the image must be aligned. The possible values are the same as the values of the IMG element.

Value Description
ABSBOTTOM 1 Aligns the bottom of the image with the bottom of the current line.

This values is not present in the HTML 3.2 and 4.0 standards.

ABSMIDDLE 2 Aligns the middle of the image with the middle of the current line.

This values is not present in the HTML 3.2 and 4.0 standards.

BASELINE 3 Aligns the bottom of the image with the baseline of the text in the line. This value does the same as align="bottom".

This values is not present in the HTML 3.2 and 4.0 standards.

BOTTOM 4 Aligns the bottom of the image with the baseline of the text in the line. This value does the same as align="baseline".
LEFT Places the image at the current left margin, temporarily changing this margin, so that subsequent text is flowed along the image's righthand side.
MIDDLE 5 Aligns the middle of the image with the baseline of the text.
RIGHT Places the image at the current right margin, temporarily changing this margin, so that subsequent text is flowed along the image's lefthand side.
TEXTTOP 6 Aligns the top of the image with the top of the text in the line.

This values is not present in the HTML 3.2 and 4.0 standards.

TOP 7 Aligns the top of the image with the top of the largest item in the line.

The numbers correspond to the example below, where you can see how the different values look:

 IMG Example 1: 2: 3: 4: 5: 6: 7:

The value LEFT and RIGHT are not included here because they effect the horizontal position on the page and not the vertical position.

The WevTV specification (v2.1) only mentions BOTTOM, LEFT, MIDDLE, RIGHT, and TOP.


W3 3.2n
4.0n
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2y
2.1n
ALLCAPS
Sets the caps mode for the on-screen keyboard so that any text that the user types will default to capital letters.
W3 3.2n
4.0n
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2y
2.1n
AUTOACTIVATE
Activates the text entry field automatically when the user selects it. When this attribute is specified for a text entry field or when the user has activated the field, the user can type in the text entry field and use the arrows to move the text cursor within the field.

Note: When this attribute is not specified for a text entry field, the user must press the center button on the remote control (or press Return on the keyboard) to activate the text entry field and be able to type. Also, when AUTOACTIVATE is not specified, the arrow buttons on the remote control move the yellow Highlight box to the next selectable item on the Web page.


W3 3.2n
4.0n
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2y
2.1n
AUTOCAPS
Defines the first letter of each word that the user types with the on-screen keyboard as a capital letter.
W3 3.2n
4.0n
NS 3.0n
4.0n
IE 3.0n TV 1.2y
2.1n
AUTOSUBMIT
Submits the form when the user leaves the page, even if the user has not explicitly selected a submit button or other such control.
W3 3.2n
4.0n
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2y
2.1y
BGCOLOR
Defines the background color for the text entry field. Colors can be specified either as hexadecimal, red-green-blue color values or as predefined color names. The default value is #EAEAEA.
See the page Using colors for a description on specifying colors.
W3 3.2n
4.0n
NS 3.0n
4.0n
IE 3.0n TV 1.2y
2.1n
BORDERIMAGE
Specifies the URL of the border image file (BIF) for the button. Possible values include "file://ROM/Borders/ButtonBorder2.bif" and "file://ROM/Borders/ButtonBorder3.bif".

ButtonBorder2.bif is used for the Done button in Setup and displays as a flat button with rounded corners.

ButtonBorder3.bif is used in the Reconnect panel and displays as a convex button with square corners.


W3 3.2y
4.0y
NS 3.0y
4.0y
IE 3.0y
4.0y
TV 1.2y
2.1y
CHECKED
This attribute is used with an input type="radio" or type="checkbox" to indicate the specific control is checked when the page is opened.
W3 3.2n
4.0n
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2y
2.1y
CURSOR
Defines the color for the cursor in the text entry field. Colors can be specified either as hexadecimal, red-green-blue color values or as predefined color names. The default value for the cursor is a dark blue (#3333AA) although many pages override this value with yellow when the text is drawn on a dark background.
See the page Using colors for a description on specifying colors.
W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0n
4.0y
TV 1.2n
2.1n
DISABLED
This attribute makes the field non-functional.

The differences between disabled fields and readonly fields
function Readonly fields Disabled fields
Getting focus can receive focus cannot receive focus
Tabbing order included in the tabbing order skipped from the tabbing order
Successful controls can be successful cannot be successful


W3 3.2y
4.0y
NS 3.0y
4.0y
IE 3.0y
4.0y
TV 1.2y
2.1y
MAXLENGTH
This attribute is used with an input type="text" or type="password" to set the maximum number of characters the user can enter in the entry-field.
W3 3.2y
4.0y
NS 3.0y
4.0y
IE 3.0y
4.0y
TV 1.2n
2.1y
NAME
Specifies the name of the control. This name will be returned to the processing program on the server.

For controls with type="radio" this attribute is used to group radio-buttons together. This is done be giving them the same name. The result is that the user can only select one of the radio-buttons in the group.


W3 3.2n
4.0n
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2y
2.1n
NOARGS
Used in conjunction with the ACTION attribute, prevents arguments from being submitted with the action for the control.

Disables the image map cursor when the user selects the input image. The WebTV interface simply submits the form, using the center point of the input image.

The WebTV interface normally displays the image map cursor when the user selects an input image. The user must select the input image twice in order to invoke its action: once to display the image map cursor and a second time to select a particular area of the input image.

For large input images with multiple "hot" areas, this behavior is ideal.

For a small input image, such as a custom button image used in place of the standard button image provided by a browser, you can avoid the second selection by using the NOCURSOR attribute.


W3 3.2n
4.0n
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2y
2.1n
NOCURSOR
Disables the image map cursor when the user selects the input image. The WebTV interface simply submits the form, using the center point of the input image.

The WebTV interface normally displays the image map cursor when the user selects an input image. The user must select the input image twice in order to invoke its action: once to display the image map cursor and a second time to select a particular area of the input image.

For large input images with multiple "hot" areas, this behavior is ideal.

For a small input image, such as a custom button image used in place of the standard button image provided by a browser, you can avoid the second selection by using the nocursor attribute.


W3 3.2n
4.0n
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2y
2.1n
NOHIGHLIGHT
Use the nohighlight attribute to prevent the yellow Highlight rectangle from drawing when the viewer selects the control.

You can use the nohighlight attribute on text entry fields. Since the text entry field, defined by <input type="text">, draws a cursor to indicate that the viewer can type there, itís not necessary to also indicate the selected field with a yellow Highlight rectangle. The nohighlight attribute can be used to disable the yellow Highlight rectangle in this case.

You can also use the nohighlight attribute if there is only one area on a page that can be selected. In this case, make the selectable area obvious to the viewer with graphics, text, formatting, or sound, since the nohighlight attribute disables the Highlight rectangle.


W3 3.2n
4.0n
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2y
2.1n
NOSUBMIT
Prevents the form from being submitted when the user presses Return on the keyboard.
W3 3.2n
4.0n
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2y
2.1n
NUMBERS
Use this attribute so that when the WebTV interface displays the on-screen keyboard, the "1" key is selected.

Note: This reduces the time the user needs to spend to move the Highlight box to the numeric keypad of the on-screen keyboard.


W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0n
4.0y
TV 1.2y
2.1y
ONBLUR
Specifies JavaScript code to execute when a text element loses focus. This attribute is valid for type="file", password, and text.
W3 3.2n
4.0y
NS 3.0y
4.0y
IE 3.0y
4.0y
TV 1.2y
2.1y
ONCHANGE
Specifies JavaScript code to execute when a text element loses focus and its value has been modified. This attribute is valid for type="file", password, and text.
W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0n
4.0y
TV 1.2y
2.1y
ONFOCUS
Specifies JavaScript code to execute when an element gets focus. This attribute is valid for type="file", password, and text.
W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0n
4.0y
TV 1.2y
2.1y
ONSELECT
Specifies JavaScript code to execute when a user selects some of the text in a text element. This attribute is valid for type="file", password, and text.
W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0n
4.0y
TV 1.2n
2.1n
READONLY
This makes it impossible for the user to change the value of the field.

The differences between disabled fields and readonly fields
function Readonly fields Disabled fields
Getting focus can receive focus cannot receive focus
Tabbing order included in the tabbing order skipped from the tabbing order
Successful controls can be successful cannot be successful


W3 3.2y
4.0y
NS 3.0y
4.0y
IE 3.0y
4.0y
TV 1.2y
2.1y
SIZE
This attributes determines the size of the control. For text and password fields this is the number of characters the control is wide. Note that this attribute doesn't set the number of allowed characters, you need the MAXLENGTH to set this. The default is 20 characters.

For other visual controls you set the number of pixels that it is wide.


W3 3.2y
4.0y
NS 3.0y
4.0y
IE 3.0y
4.0y
TV 1.2n
2.1n
SRC
Allowed with type="image", this attribute specifies the url of the image.
W3 3.2n
4.0n
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2y
2.1n
SUBMITFORM
In version 1.1 of the WebTV HTML interface, use the submitform attribute to submit all form data when the viewer changes the value of a particular control in the form.

Note: When the ACTION attribute is set for a control, the value for the control is sent to the server immediately. If the SUBMITFORM attribute is not set, only the value for the selected control is submitted.

Note: When both the ACTION and SUBMITFORM attributes are set for the control, the WebTV interface submits the values for the entire form using the action for the control.


W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0n
4.0y
TV 1.2n
2.1n
TABINDEX
Description of the TABINDEX attribute
W3 3.2n
4.0n
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2y
2.1n
USEFORM
Specifies the name of the form to submit when the user selects this button. The default value is the name of the form that contains the button.

Note: You can use the USEFORM attribute to submit the name of a form elsewhere on the page. For example, a button in the sidebar can submit the name of a form in the content area of the page. (For more information, see the NAME and ID attributes of the FORM element.)


W3 3.2n
4.0n
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2y
2.1y
USESTYLE
Displays text in the Submit button in the style currently in effect for the page.
W3 3.2y
4.0y
NS 3.0y
4.0y
IE 3.0y
4.0y
TV 1.2y
2.1y
VALUE
Depending on the TYPE, the value is used in different ways :

Value Description
Boolean controls (CHECKBOX, RADIO) Specifies the value to be returned when the control is turned on. This attribute must be supplied for radio fields.
Button controls (BUTTON, RESET, SUBMIT) Specifies the text of the button.
Textual/numerical controls (HIDDEN, PASSWORD, TEXT) Specifies the default value of the control.


W3 3.2n
4.0n
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2y
2.1y
WIDTH
Use the width attribute to set the width of the control in pixels. By default, the width fits the text content of the input. If the control displays text, the WebTV interface truncates the text and follows it with an ellipsis if the text can't fit within the width.

Examples

Source
<FORM>
Enter your name <INPUT type="text" size="20" maxlength="30">
</FORM>
 
Result
Enter your name
 
Source
<FORM>
Select your favorite color
<SELECT>
<OPTION>Red
<OPTION>Orange
<OPTION>Yellow
<OPTION>Green
<OPTION>Purple
<OPTION>Blue
</SELECT>
<INPUT type="button" name="ColorButton" value=" Push here "
onclick="ColorButton.value='You pushed me'">
</FORM>
 
Result
Select your favorite color
 
Source
<FORM><TABLE border="2"><TR><TD>
<TABLE>
<TR>
<TD>Show toolbar as</TD>
<TD><INPUT type="radio" name="toolbar"> Pictures</TD>
<TD><INPUT type="radio" name="toolbar" CHECKED> Text</TD>
<TD><INPUT type="radio" name="toolbar"> Pictures and Text</TD>
</TR>
<TR>
<TD colspan="4"><HR></TD>
</TR>
<TR>
<TD>On startup launch</TD>
<TD><INPUT type="checkbox" name="launch" checked> Browser</TD>
</TR>
<TR>
<TD></TD><TD><INPUT type="checkbox" name="launch" checked> Mail</TD>
</TR>
<TR>
<TD></TD><TD><INPUT type="checkbox" name="launch"> Newsreader</TD>
</TR>
</TABLE>
</TD></TR></TABLE></FORM>
 
Result
Show toolbar as Pictures Text Pictures and Text

On startup launch Browser
Mail
Newsreader
Statistics