input type="reset" Element


 

Module

The input type="reset" element is an inline element declared by the XHTML 1.1 Forms Module

Elements in the Forms Module are:
form | label | textarea | select | optgroup | option | button | fieldset | legend |
input type="button" | input type="checkbox" | input type="file" | input type="hidden" | input type="image" | input type="password" | input type="radio" | input type="reset" | input type="submit" | input type="text"

Description

The input type="reset" element may be used within a form to create a reset button which, when activated by the user, will reset all the form's controls to the state they were in when the form was first rendered, discarding any user modifications. The input type="reset" button's text is given by the contents of its value attribute (or some browser default text - usually "Reset" - if no value attribute is specified).

Example reset button:

<input type="reset" value="Reset Form" />

On form reset, only those checkboxes (see input type="checkbox") and radio buttons (see input type="radio") which were given the checked attribute will be checked. Similary, only those option elements which were given the selected attribute will be selected. Any file upload choices made using an input type="file" element will be removed and any fields containing text (i.e. input type="text", input type="password" and textarea controls) will be returned to their initial values (given by the value attribute or, in the case of textarea, by the element's content).

The decision on whether to include a reset button in a form should be made on a case-by-case basis. For very short forms, it is probably easier for the user just to amend each choice individually. For very long forms, particularly those containing textarea elements, where a large amount of data may have been entered by the user, an accidental press of a reset button (which looks very much like a submit button at first glance) may wipe out many minutes of work without the possibility of undoing the reset. Scripting may of course be used to bring up a dialogue asking the user to confirm the reset, but not all users will have scripting enabled.

Note: No name=value pair is sent to the processing URI for an input type="reset" element.

See also the button element.

Padding Issues

In Internet Explorer, for reasons unknown, buttons with long text content are usually rendered with excessive horizontal padding - the longer the button text, the more excessive the padding. This annoyance can be avoided by using the CSS declarations width:auto; overflow:visible; and setting the padding property to the desired value.

#REQUIRED Attributes

Although the type attribute is not #REQUIRED on the input element, its default value is "text" and so must be present on input type="reset".


Specific Attributes

Specific attributes of the input type="reset" element are listed below:

From the Forms Module - the Element's own Module

accesskey [ type Character ]
Key to be pressed which allows the reset button to be activated directly from the keyboard
disabled [ type Boolean ]
If this attribute is present, the reset button is initially disabled. The user cannot interact with a disabled control.
name [ type CDATA ]
A name for the reset button. A name=value pair is not sent to the processing URI for a reset button and the so the name attribute is usually only used to refer to the button from within scripts.
tabindex [ type Number ]
An integer between 0 and 32767 specifying the position of the reset button in the tabbing order of the document
value [ type CDATA ]
Specifies the text to be used as the button label, which will override the default value provided by the browser (usually "Reset").

From the Intrinsic Events Module

onblur [ type Script ]
Script to be executed when the element loses focus
onfocus [ type Script ]
Script to be executed when the element receives focus

Common Attributes

Common attributes of the input type="reset" element are listed below:

From the Core Attribute Collection

class [ type NMTOKENS ]
One or more space separated classes
id [ type ID ]
A unique identifier for the element
style [ type CDATA ], from the Style Attribute Module (deprecated)
Element-specific styles
title [ type Text ]
Descriptive title for the element (in some user agents this may appear as a "tooltip" when the mouse hovers over the element)
xmlns [ type URI - #FIXED 'http://www.w3.org/1999/xhtml' ]
XML namespace

From the I18N Attribute Collection

dir [ type Enumeration (ltr | rtl) ], from the Bi-directional Text Module
Left-to-right or right-to-left directionality
xml:lang [ type LanguageCode ]
A language code for the element

From the Events Attribute Collection

All attributes in the Events Attribute Collection are supported:
onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup


Content Model

The Content Model for the input type="reset" element is:

EMPTY

See Content Model & Nesting for information about Content Model syntax and Nesting Groups.

Valid children of input type="reset"

This element is empty and may have no children.

Valid parents of input type="reset"


Page Footer & Copyright

Copyright © Sally Maughan 2005-2009 (Page last updated on 01 Oct 2009)

*Valid XHTML 1.1 - hosted by *Openstrike

Content based on the W3C Working Draft: *XHTML 1.1 and Recommendation: *XHTML Modularisation 1.1.

W3C, XHTML, XML, HTML, CSS and MathML are *Trademarks of the W3C (*MIT, *ERCIM, *Keio) with which the site's author has no connection.


Up, Next & Previous Links

Your Location

Home > XHTML 1.1 Home > XHTML 1.1 Indexes > Element Index (XHTML 1.1) > input Elements > input type="reset"