OBJECT:  Hidden


A Hidden object provides a text object on a form that is hidden from the user and is created with every instance of an HTML <INPUT> tag with the type attribute set to 'hidden'. A Hidden object is used to pass name/value pairs when the form is submitted. These objects are then stored in the elements array of the parent form and accessed using either the name defined within the HTML tag or an integer (with '0' being the first element defined, in source order, in the specified form).

The following example creates a button that, when clicked, displays the Hidden object's value in an alert box.

Code:
<form action="" method="POST" id="myForm">
<input type="Hidden" name="objHidden" value="" id="objHidden">
<input type="Button" name="" value="Get hidden value" id="myButton" onClick=getHidden()>

<script type="" language="JavaScript">
myForm.objHidden.value=("Hidden object example")

function getHidden() {
      y=myForm.objHidden.value
     self.alert("The Hidden object's value is : " + y)
}

</script> </form>



PROPERTIES

form Property
This property returns a reference to the parent Form of the Hidden object.

Syntax: object.form

name Property
This property sets or returns the value of the Hidden object's name attribute.

Syntax: object.name

type Property
Every element on a form has an associated type property. In the case of a Hidden object, the value of this property is always "hidden".

Syntax: object.type

value Property
This property sets or returns the Hidden object's value attribute. This is the text that is held in the Hidden object until the form is submitted.

Syntax: object.value


METHODS

The Hidden object inherits the watch and unwatch methods of the Object object.


Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information