input type="hidden" Element


 

Module

The input type="hidden" 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

input type="hidden" elements are used within a form to include any parameters which do not need to be known or modified by the user. The hidden input is not rendered by the user agent at all, so the user will only know it is there if they inspect the source code for the page. This is very easy to do, however, so hidden inputs should not be used for sensitive information.

Hidden inputs are often used to maintain "state" information between pages, e.g. relevant internal system identifiers, but may be used for any information desired. They can, for example, be used to pass behind-the-scenes information from the document to a client-side script.

For example, a hidden system id can be included as follows:

<input type="hidden" name="id" value="HJ234DNAG134XBE2" />

The input above will be passed to the processing URI on form submission as the name=value pair: id=HJ234DNAG134XBE2

#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="hidden".


Specific Attributes

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

From the Forms Module - the Element's own Module

disabled [ type Boolean ]
If this attribute is present, the hidden input element is initially disabled - no data is sent to the processing URI for disabled elements when the form is submitted
name [ type CDATA ]
This is the name sent to the processing URI for the hidden input field when the form is submitted (if the name attribute is not present, the value of the hidden field will not be sent). The value sent (in a name=value pair) is that of the value attribute of the hidden input.

Note: Although technically optional, a note in the *Forms Module DTD says that the name attribute is required on all input elements except "submit" and "reset"

value [ type CDATA ]
A value for the hidden element. Since a hidden element is not rendered as page content in any way and the user cannot interact directly with it, this value may be changed only indirectly - using, for example, JavaScript.

Common Attributes

Common attributes of the input type="hidden" 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="hidden" element is:

EMPTY

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

Valid children of input type="hidden"

This element is empty and may have no children.

Valid parents of input type="hidden"


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="hidden"