| |||||||
FRAMES NO FRAMES |
Use the webuijsf:editableField
tag to create an input
field for a single line of text.
The editableField component renders a borderless readonly XHTML <input
type="text">
element that can be edited inline. An initial (
read-only ) state resembles regular static text, and it can be edited
by using the onDblClick event or when the <SPACE> key is pressed. Once the field looses
the focus ( as a result of onBlur event), it enters a read-only state again.
The EditableField component inherits most of the functionality and attributes from
TextField. See the webuijsf:textField
component description
for details and examples.
webuijsf:editableField
TagSee the webuijsf:editableField
component description for
details and examples. With the exception of the autoValidate, all of the
usage and attribute examples for textField can be used with editableField
by replacing tag into webuijsf:editableField
.
document.getElementById(id).setProps({disabled:
true})
.JavaScript Function | Description |
---|---|
getInputElement() |
Accesses the
HTML <input> element that is rendered by the
component. |
getProps() |
Gets widget properties. Please see setProps()
function for a list of supported properties. |
refresh(execute) |
Asynchronously refreshes the component.
|
setProps(props) |
Changes any of the following supported
properties:
|
submit(execute) |
Asynchronously submits 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, subscribe to any of these events in order to add
custom logic to the editableField behavior. For example:
<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>
The following events are supported.
Event | Description |
---|---|
<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:
|
<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:
|
<webuijsf:radioButton id="rb1" name="rb1" label="Toggle Field Disabled" onClick="toggleDisabled()"/><webuijsf:editableField id="field1" text="My Text Field" />
<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:editableField id="field1" text="
#{MyBean.text}" />
<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:editableField id="field1" text="#{MyBean.text}" /> // Field used to asynchronously update text.
<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>
Tag Information | |
Tag Class | com.sun.webui.jsf.component.EditableFieldTag |
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. |
autoSave | false | false | java.lang.String | Attribute indicating to turn on/off the autoSave functionality of the EditableField.
When on, an Ajax submit event will be generated every time component looses
focus with modified data. If data is not modified, no Ajax request will be
submitted.
AutoSave will submit the content of the text field for server side processing that will be processed using JSFX partial lifecycle cycle. Component on the client will not be updated as per results of the submit. If validation fails, for example, the server state of the component will not be updated ( UPDATE_MODEL phase is not invoked), while client side component will still reflect the user modified invalid data. By default autoSave is on. |
submitForm | false | false | java.lang.String | Flag indicating whether pressing enter in this text field would allow
browser to submit the enclosing form ( for all input fields with the exception of TextArea
which uses enter key to open a new line) |
onDblClick | false | false | java.lang.String | Scripting code executed when a mouse double click occurs over this component. |
trim | false | false | java.lang.String | Flag indicating that any leading and trailing blanks will be trimmed prior to conversion to the destination data type. Default value is true. |
onKeyPress | false | false | java.lang.String | Scripting code executed when the user presses and releases a key while the component has focus. |
onSelect | false | false | java.lang.String | Scripting code executed when some text in this component value is selected. |
onFocus | false | false | java.lang.String | Scripting code executed when this component receives focus. An element receives focus when the user selects the element by pressing the tab key or clicking the mouse. |
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. |
columns | false | false | java.lang.String | Number of character columns used to render this field. The default is 20. |
id | false | true | java.lang.String | No Description |
onKeyUp | false | false | java.lang.String | Scripting code executed when the user releases a key while the component has focus. |
onMouseUp | false | false | java.lang.String | Scripting code executed when the user releases a mouse button while the mouse pointer is on the component. |
styleClass | false | false | java.lang.String | CSS style class(es) to be applied to the outermost HTML element when this component is rendered. |
style | false | false | java.lang.String | CSS style(s) to be applied to the outermost HTML element when this component is rendered. |
onClick | false | false | java.lang.String | Scripting code executed when a mouse click occurs over this component. |
onBlur | false | false | java.lang.String | Scripting code executed when this element loses focus. |
onMouseDown | false | false | java.lang.String | Scripting code executed when the user presses a mouse button while the mouse pointer is on the component. |
toolTip | false | false | java.lang.String | Sets the value of the title attribute for the HTML element. The specified text will display as a tooltip if the mouse cursor hovers over the HTML element. |
maxLength | false | false | java.lang.String | The maximum number of characters that can be entered for this field. |
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:
|
required | false | false | java.lang.String | Flag indicating that an input value for this field is mandatory, and failure to provide one will trigger a validation error. |
disabled | false | false | java.lang.String | Flag indicating that the user is not permitted to activate this component, and that the component's value will not be submitted with the form. |
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. |
onMouseOut | false | false | java.lang.String | Scripting code executed when a mouse out movement occurs over this component. |
onMouseOver | false | false | java.lang.String | Scripting code executed when the user moves the mouse pointer into the boundary of this component. |
htmlTemplate | false | false | java.lang.String | Alternative HTML template to be used by this component. |
onMouseMove | false | false | java.lang.String | Scripting code executed when the user moves the mouse pointer while over the component. |
text | false | false | java.lang.String | Literal value to be rendered in this input field. If this property is specified by a value binding expression, the corresponding value will be updated if validation succeeds. |
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. |
label | false | false | java.lang.String | If set, a label is rendered adjacent to the component with the value of this attribute as the label text. |
onChange | false | false | java.lang.String | Scripting code executed when the element value of this component is changed. |
visible | false | false | java.lang.String | Use the visible attribute to indicate whether the component should be viewable by the user in the rendered HTML page. |
onKeyDown | false | false | java.lang.String | Scripting code executed when the user presses down on a key while the component has focus. |
readOnly | false | false | java.lang.String | Flag indicating that modification of this component by the user is not currently permitted, but that it will be included when the form is submitted. |
labelLevel | false | false | java.lang.String | Sets the style level for the generated label, provided the label attribute has been set. Valid values are 1 (largest), 2 and 3 (smallest). The default value is 2. |
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 .
|
tabIndex | false | false | java.lang.String | Position of this element in the tabbing order of the current document. Tabbing order determines the sequence in which elements receive focus when the tab key is pressed. The value must be an integer between 0 and 32767. |
notify | false | false | java.lang.String | The comma separated list of absolute client IDs to notify during
text field events.
Currently, this feature is only supported by label and alert components. For example, when the label attribute of the textField tag is not used. Or, when an alert is used in the page to display validation messages. During auto-validation, the text field will notify the label and alert associated with the given client IDs. If the user's input is found to be invalid, the label will change text color and display an error indicator. Likewise, if there are any messages associated with the event, the alert will display the assocaited summary, detail, and error indicator. |
Variables | No Variables Defined. |
| |||||||
FRAMES NO FRAMES |