| |||||||
FRAMES NO FRAMES |
Use the webuijsf: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.
The hiddenField component renders an XHTML <input
type="hidden">
element.
webuijsf:hiddenField
TagUse 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.
This component has no facets.
This component does not use any style classes from the theme.
document.getElementById(id).setProps({disabled:
true})
.getProps() |
Use this function to get widget properties. Please see setProps()
function for a list of supported properties. |
refresh(execute) |
Use this function to
asynchronously refresh the component.
|
setProps(props) |
Use this function to change any of the following supported
properties:
|
submit(execute) |
Use this function to
asynchronously submit the component.
|
subscribe(topic, obj, func) |
Use this function to subscribe
to an event topic.
|
When the component is manipulated client side, some functions may
publish event topics for custom AJAX implementations to listen for.
For example, you can listen for the refresh event topic using:
<webuijsf:script>
var processEvents =
{
update: function(props) {
//
Do something...
}
}
// Subscribe to refresh event.
var domNode = document.getElementById("form1:test1");
domNode.subscribe(domNode.event.refresh.endTopic,
processEvents, "update");
</webuijsf:script>
<Node>.event.refresh.beginTopic | Event topic published before asynchronously refreshing the
component. Supported properties include:
|
<Node>.event.refresh.endTopic | Event topic published after asynchronously refreshing the
component. Supported properties include: See setProps() function.
|
<Node>.event.submit.beginTopic | Event topic published before asynchronously submitting the
component. Supported properties include:
|
<Node>.event.submit.endTopic |
Event topic published after asynchronously submitting the component. Supported properties include:
|
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.
<webuijsf:hiddenField id="counter" value="#{FieldTest.counter}"/>
<webuijsf:radioButton id="rb1" name="rb1" label="Toggle Field Disabled" onClick="toggleDisabled()"/><webuijsf:textField id="field1"
value="
#{MyBean.value}"
/>
<webuijsf:script>
function toggleDisabled() {
var domNode = document.getElementById("form1:field1
"); // Get field
return domNode.setProps({disabled: !domNode.getProps().disabled}); // Toggle disabled state
}
</webuijsf:script>
<webuijsf:radioButton id="rb1" name="rb1" label="Refresh Text Field" onClick="refreshField()"/><webuijsf:hiddenField id="field1" value="
#{MyBean.value}" />
<webuijsf:script>
function refreshField() {
var domNode =
document.getElementById("form1:field1"); // Get field
return domNode.refresh(); //
Asynchronously refresh field
}
</webuijsf:script>
Note that the refresh function can optionally take a list of
elements
to execute. Thus, a comma-separated list of ids can be provided to
update components server-side: refresh("form1:id1,form2:id2,..."). When
no parameter is given, the refresh function acts as a reset.
That is, the component will be redrawn using values set
server-side, but not updated.<webuijsf:radioButton id="rb1" name="rb1" label="Refresh Text Field" onClick="refreshField()"/><webuijsf:hiddenField id="field1" value="
#{MyBean.value}" />
// Field used to asynchronously update value.
<webuijsf:script>
function
refreshField
() {
var domNode =
document.getElementById("form1:field1"); // Get field
return
domNode.refresh("form1:rb1"); // Asynchronously refresh while
submitting radio button value
}
</webuijsf:script>
Note that the refresh function can optionally take a list of
elements
to execute. Thus, a comma-separated list of ids can be provided to
update components server-side: refresh("form1:id1,form2:id2,...")Tag Information | |
Tag Class | com.sun.webui.jsf.component.HiddenFieldTag |
TagExtraInfo Class | None |
Body Content | JSP |
Display Name | None |
Attributes | ||||
Name | Required | Request-time | Type | Description |
binding | false | false | java.lang.String | A ValueExpression that resolves to the UIComponent that corresponds to this tag. This attribute allows the Java bean that contains the UIComponent to manipulate the UIComponent, its properties, and its children. |
htmlTemplate | false | false | java.lang.String | Alternative HTML template to be used by this component. |
text | false | false | java.lang.String | Literal value to be rendered in this hidden field. If this property is specified by a value binding expression, the corresponding value will be updated if validation succeeds. |
disabled | false | false | java.lang.String | Flag indicating that the hidden field should not send its value to the server. |
converter | false | false | java.lang.String | Specifies a method to translate native
property values to String and back for this component. The converter
attribute value must be one of the following:
|
immediate | false | false | java.lang.String | Flag indicating that event handling for this component should be handled immediately (in Apply Request Values phase) rather than waiting until Invoke Application phase. |
validatorExpression | false | false | java.lang.String | Used to specify a method in a backing bean to validate input
to the component. The value must be a JavaServer Faces
EL expression that resolves to a public method with
return type void. The method must take three parameters:
The backing bean where the method is defined must implement
The method is invoked during the Process Validations Phase. |
rendered | false | false | java.lang.String | Indicates whether the HTML code for the component should be included in the rendered HTML page. If set to false, the rendered HTML page does not include the HTML for the component. If the component is not rendered, it is also not processed on any subsequent form submission. |
valueChangeListenerExpression | false | false | java.lang.String | Specifies a method to handle a value-change event that is triggered
when the user enters data in the input component. The
attribute value must be a JavaServer Faces EL expression that
resolves to a backing bean method. The method must take a single
parameter of type javax.faces.event.ValueChangeEvent ,
and its return type must be void. The backing bean where the
method is defined must implement java.io.Serializable
or javax.faces.component.StateHolder .
|
id | false | true | java.lang.String | No Description |
Variables | No Variables Defined. |
| |||||||
FRAMES NO FRAMES |