input (type="hidden") | NN 3 IE 4 DOM 1 | ||||||
The hidden object is a form control generated with an input element that has its type attribute is set to "hidden". This element has no event handlers, because users do not interact directly with the element. Be aware that any values assigned to a hidden object are removed if the user reloads the page. In other words, it does not function as a persistent store. Internet Explorer for Windows and Netscape 6 expose many more properties than are listed below. Most of these are included in the internal object definition for consistency across other text-oriented form controls, but have no practical significance for a hidden object. |
|||||||
HTML Equivalent | |||||||
<input type="hidden"> |
|||||||
Object Model Reference | |||||||
[window.]document.formName.elementName [window.]document.forms[i].elements[i] [window.]document.getElementById("elementID") |
|||||||
Object-Specific Properties | |||||||
|
|||||||
Object-Specific Methods | |||||||
|
|||||||
Object-Specific Event Handler Properties | |||||||
None. |
dataFld | NN n/a IE 4 DOM n/a |
Read/Write | |
Used with IE data binding to associate a remote data source column name with the element's value. A datasrc attribute must also be set for the element. Setting both the dataFld and dataSrc properties to empty strings breaks the binding between element and data source. Works only with text file data sources in IE 5/Mac. |
|
Example | |
document.myForm.price.dataFld = "price"; |
|
Value | |
Case-sensitive identifier of the data source column. |
|
Default | |
None. |
dataSrc | NN n/a IE 4 DOM n/a |
Read/Write | |
Used with IE data binding to specify the ID of the page's object element that loads the data source object for remote data access. Setting both the dataFld and dataSrc properties to empty strings breaks the binding between element and data source. Works only with text file data sources in IE 5/Mac. |
|
Example | |
document.myForm.price.dataSrc = "DBSRC3"; |
|
Value | |
Case-sensitive identifier of the data source. |
|
Default | |
None. |
defaultValue | NN 2 IE 3 DOM n/a |
Read-only | |
Returns the string assigned to the value attribute of the element in the source code. You can use this value to reassign the original value to the element if scripts have altered the value property during other processing. |
|
Example | |
document.entryForm.sessionID.value = document.entryForm.sessionID.defaultValue; |
|
Value | |
String. |
|
Default | |
None. |
form | NN 2 IE 3 DOM 1 |
Read-only | |
Returns a reference to the form element that contains the current element (if any). When processing an event from this element, the event handler function automatically has access to the input element (as the event object's target or srcElement property). By reading the form property, the script can easily access other controls within the same form. |
|
Example | |
var theForm = evt.srcElement.form; |
|
Value | |
form element object reference. |
|
Default | |
None. |
name | NN 2 IE 3 DOM 1 |
Read/Write | |
This is the identifier associated with the form control. The value of this property is submitted as one-half of the name/value pair when the form is submitted to the server. Names are hidden from user view, since control labels are assigned via other means, depending on the control type. Form control names may also be used by script references to the objects. Despite the modern standards' preference for the id attribute, many browsers still require that a form control be assigned a name attribute to allow the control's value to be submitted. |
|
Example | |
document.orderForm.compName.name = "company"; |
|
Value | |
Case-sensitive string identifier that follows the rules of identifier naming: it may contain no whitespace, cannot begin with a numeral, and should avoid punctuation except for the underscore character. |
|
Default | |
None. |
type | NN 3 IE 4 DOM 1 |
Read-only | |
Returns the type of form control element. The value is returned in all lowercase letters. It may be necessary to cycle through all form elements in search of specific types to do some processing on (e.g., emptying all form controls of type "text" while leaving other controls untouched). |
|
Example | |
if (document.forms[0].elements[3].type == "hidden") { // process hidden input type here } |
|
Value | |
Any of the following constants (as a string): button | checkbox | file | hidden | image | password | radio | reset | select-multiple | select-one | submit | text | textarea. |
|
Default | |
hidden |
value | NN 2 IE 3 DOM 1 |
Read/Write | |
Indicates the current value associated with the form control that is submitted with the name/value pair for the element. All values are strings, but they may represent other kinds of data, including Boolean and numeric values. |
|
Example | |
document.forms[0].price.value = "33.95"; |
|
Value | |
String. |
|
Default | |
None. |
createTextRange( ) | NN n/a IE 4(Win) DOM n/a |
Creates a TextRange object containing the hidden field's string value. See the TextRange object for details. |
|
Parameters | |
None. |
|
Returned Value | |
TextRange object. |