The Hidden Field component is a form field that is not visible, but can
be used to pass data to the server as well as to hold data that can be interpreted by Javascript on the page. A typical use of a
hidden field is to store session data in the page as an alternative to using the Session bean to store the data. For example, you might use a hidden field to pass the primary key of the current
row back to the same page, instead of saving and restoring it in session scope.
A Hidden Field component is equivalent to the HTML tag <input
type='hidden'>
. The text
property holds the value of the field, which is a Java Object
that is the
data the field stores and passes back to the server when the
form is submitted.
Since the field is hidden, the component does not appear on the page, but it does appear in the You can select the hidden field in the Navigator window and right-click it to open its pop-up menu.
After adding a hidden field to a Visual Web JSF page, you can do a number of things with it:
id
attribute. In the page bean, this property's value is
the name of the HiddenField
object.validate
method so you can insert code to validate the value of the component.processValueChange
method so you can insert code that executes when the value of this component changes. This method executes when you have selected Auto-Submit on Change from the component's pop-up menu, which submits the page when the value of the component changes. This technique is useful if the component is part of a virtual form.value
property to a data provider or an object so you can evaluate the component's value when the page is submitted. For more information, see Bind to Data Dialog Box.value
property to other objects
or properties that supply data for the values of this
component's properties.