Use the ui:hiddenField tag to create a hidden field,
which is present in the HTML, but not displayed to the user.
Hidden fields are useful for saving state information.
HTML Elements and Layout
The hiddenField component renders an XHTML <input
type="hidden"> element.
Configuring the ui:hiddenField Tag
Use the value attribute to associate
the component with a model object that represents the current value,
by setting the attribute's value to a JavaServer Faces EL expression
that corresponds to a property of a backing bean.
Facets
This component has no facets.
Theme Identifiers
This component does not use any style classes from the theme.
Client-side JavaScript functions
In all the functions below, <id> should be
the generated id of the HiddenField component.
field_setDisabled(<id>, <disabled>)
|
Enable/disable the field. Set <disabled>
to true to disable the component, or false to enable it.
|
field_setValue(<id>, <newValue>)
|
Set the value of the field to <newValue> .
|
field_getValue(<id>)
|
Get the value of the field. |
field_getInputElement(<id>) |
Get hold of a reference to the input element rendered by this
component.
|
Examples
This example uses a backing bean FieldTest with a
property counter . The property is an int but
it is not necessary to specify a converter since the default
JavaServer Faces converter will be used. The value of the hidden
field may be updated through a JavaScript. The tag generates an
HTML input element.
<ui:hiddenField id="counter" value="#{FieldTest.counter}"/>
Auto-generated component class.
Do NOT modify; all changes
will be lost!
|