Input

Lets you create an input field for the following types of data: String, Number, Date/Time, and Mask. When you add an input component to a page, choose one of the formats on the Properties view for the Input component.

 

Component at design time

Drag and drop a

Input component onto the page:

The

Input component on the page at design time:

 

Component at runtime

The

Input component on the page at runtime:

 

Properties and All Attributes views

The Properties view for a component shows the most common set of attributes you can set on a component, and, depending on the component, you might also see options for adding controls, actions, or other components. To open the Properties view, click

Window | Show View | Properties.

These common attributes for the Input component display on the h:inputText, Validation, Behavior, and Accessibility tabs in the Properties view. See the All Input attributes table for a complete list of attributes. Additional configuration options to validate input, modify behavior, and configure input format types are on the h:inputText>Validation, h:inputText>Behavior, h:inputText and tabs:

Table 1. Input configuration options

Configuration option

Description

Auto-advance to next field

Specifies whether auto-tabbing is enabled or disabled. Automatically advances user to another input field after the specified number of characters has been entered. When checked adds the hx:inputHelperAssist section to the All Attributes view and sets autoTab to True.

Click to create/edit custom validation code

Switches to the Quick Edit view so that scripts or snippets of code may be entered for various user initiated events.

Constraint

Limits the type of characters that can be entered into the component (for example, Digits Only or ASCII Alphabet Only). Adds hx:validateConstraint with the regex attribute to the All Attributes view.

Display validation error messages in an error message control

Inserts an error message component associated with the selected component. This will display an error message if the validation fails.

Format

Specifies the format of the data to be manipulated by the component:

  • String - Specifies that the output should be in the form of a text string.

  • Number - Specifies that the output should be in the form of a number.

  • Date/Time - Specifies that the output should be in the form of date and/or time.

  • Mask - Specifies that the output be filtered in a way that selectively includes or excludes certain values.
Refer to the individual format types table for details.

Maximum length

The maximum number of characters this component can contain when submitted on the server. Adds the function f:validateLength with a maximum attribute to the All Attributes view.

Minimum length

The minimum number of characters this component can contain when submitted on the server. Adds a function f:validateLength with a minimum attribute to the All Attributes view.

Validate field value in the browser

Allows for the field validation to happen in the browser at runtime.

Table 2. Format type configuration options

Format type

Format options

String

h:inputText tab:

  • Id

  • Value

  • Style: Props

  • Style: Classes

  • Size: Width

Validation tab:

  • Value is Required

  • Maximum length

  • Minimum length

  • Constraint

  • Click to create/edit custom validation code

  • Display validation error messages in an error message control

Behavior tab:

  • Control is disabled

  • Control is read-only

  • Auto-advance to next field

  • After user types X characters

  • Validate field value in the browser

  • onBlur and onFocus actions

Number

h:inputText tab:

  • Id

  • Value

  • Style: Props

  • Style: Classes

  • Size: Width

  • Type: Decimal

  • Options

  • Integer Only

  • Show Helper Button

  • Type

  • Increment

  • Show Prompt Character

  • Prompt Character

  • Type: Currency

  • Options

  • Currency Symbol

  • Integer Only

  • Show Helper Button

  • Type

  • Increment

  • Show Prompt Character

  • Prompt Character

  • Type: Percent

  • Options

  • Integer Only

  • Show Helper Button

  • Type

  • Increment

  • Show Prompt Character

  • Prompt Character

  • Type: Custom

  • Options

  • Pattern

  • Show Helper Button

  • Type

  • Increment

  • Show Prompt Character

  • Prompt Character

Validation tab:

  • Value is required

  • Use simple validation

  • Minimum

  • Maximum

  • Use advanced validation

  • Advanced validation expression

  • Click to create/edit validation code

  • Display validation error messages in an error message control

Behavior tab:

  • Control is disabled

  • Control is read-only

  • Auto-advance to next field

  • After user types X characters

  • Validate field in the browser

  • onblur Actions

  • onfocus Actions

Date/Time

h:inputText tab:

  • Id

  • Value

  • Style: Props

  • Style: Classes

  • Size: Width

  • Type: Date Only

  • Options

  • Date Style

  • Show helper button

  • Show prompt character

  • Prompt character

  • Type: Time Only

  • Options

  • Time Style

  • Show helper button

  • Increment

  • Show prompt character

  • Prompt character

  • Type: Date and time

  • Options

  • Date Style

  • Time Style

  • Show prompt character

  • Prompt character

Validation tab:

  • Value is required

  • Use simple validation

  • Minimum

  • Maximum

  • Use advanced validation

  • Advanced validation expression

  • Click to create/edit validation code

  • Use yyyy/dd/mm or hh:mm:ss or now.

  • Display validation error messages in an error message control

Behavior tab:

  • Control is disabled

  • Control is read-only

  • Auto-advance to next field

  • Validate field in the browser

  • onblur Actions

  • onfocus Actions

Mask

h:inputText tab:

  • Id

  • Value

  • Style: Props

  • Style: Classes

  • Size: Width

  • Options

  • Mask

  • Show prompt character

  • Prompt character

Validation tab:

  • Value is required

  • Minimum length

  • Maximum length

  • Click to create/edit custom validation code

  • Display validation error messages in an error message control

Behavior tab:

  • Control is disabled

  • Control is read-only

  • Auto-advance to next field

  • After user types X characters

  • Validate field value in the browser

  • onblur Actions

  • onfocus Actions

The All Attributes view shows a table of all the attributes you can set on a component, which includes those attributes you can access from the Properties view. To switch to the All Attributes view, click the

All Attributes icon in the upper right corner of the Properties view.

Table 3. All Input attributes

Attribute name

Represented in Properties view by

Description

accesskey

Accessibility>Access Key

Specifies a single keyboard key as an access key. Pressing the specified access key at runtime gives focus to this component. Pressing ALT plus the specified access key at runtime gives focus to this component (or executes the component if it is a kind of button).

alt

Not represented

Specifies alternate text for a component. The alternative text is displayed when the element cannot be rendered normally, for example, in browsers that do not support forms and in browsers set to not display images.

binding

Not represented

An expression that binds the component's instance (usually a user interface component) to a bean property (usually in the backing file).

converter

Not represented

Specifies the data type to which the value is converted. The JavaServer Faces implementation provides a set of Converter implementations that you can use to convert your component data to a type not supported by its renderer.

dir

Not represented

Specifies the component's direction when rendered at runtime. The values can be either:

  • ltr - left to right

  • rtl - right to left
If the direction is not specified, a direction appropriate to the encoding of the component is used.

disabled

Behavior>Control is disabled

If disabled is set to true, the component is displayed at runtime but is not functional. If left blank, the default value is false.

id

ID

Assigns a name to a component. Should be a unique name within a JSP.

immediate

Not represented

If true, skip straight to render phase of life cycle.

lang

Not represented

The language of the component's value(s) and text content. If omitted, the language is inherited from the containing tags (notably the view. Specified as an ISO-standard language abbreviation code. For example, "en" for English, "en-US" for American English, "fr" for French, "de" for German.

Note: This does not "translate" the text in the component, rather, it identifies the language of the component so that operations such as searching, sorting, collating and the like are done correctly.

maxlength

Behavior>After user types X characters

Enact the control attribute after an end user enters this many characters into the component.

readonly

Behavior>Control is read-only

Specifies that the value of the component cannot be changed from its initial value.

rendered

Not represented

Can be set to true or false:

  • false - Component will not be rendered to the browser at runtime.

  • true - Component will get rendered. This is the default value.

required

Validation>Value is Required

The component must be specified. Check this to require the user to enter a value.

size

Size: Width

Specifies the initial width of the component, where its value refers to the number of characters.

style

Style: Props

Specifies CSS style information for the component (for example, style="font-size : 8pt ; color : red"). Defines the properties (such as font and color) of the selected component. This may be done manually, or by clicking the button and selecting the desired properties from within the window.

styleClass

Style: Classes

Space-separated list of CSS style classes to be applied when this element is rendered. This value must be passed through as the class attribute on generated markup. Defines the classes (such as style sheets) of the selected component. This may be done manually, or by clicking the button and selecting the desired Classes from within the window.

tabindex

Accessibility>Tab order index

Specifies the position of the component in the tabbing order in the JSP. This value must be a number between 0 and 32767.

title

Accessibility>Title

Specifies the title text, shown in browser as a tooltip at runtime. Used by a browser as the alternative text of a component if the alternative text is not specified.

validator

Not represented

A method (represented by a MethodBinding expression) that accepts FacesContext, UIComponent, and Object parameters. It is called during the validation process to ensure that value of the component is correct.

value

Value

Specifies the initial text value for the component displayed at runtime. Contains information to be displayed, in the form of a specified value or a pointer to a dynamic value.

valueChangeListener

Not represented

Method to be notified when value of component has changed.